Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/codemirror-vim-core/test/vim_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2655,6 +2655,13 @@ testVim('visual_blank', function(cm, vim, helpers) {
helpers.doKeys('v', 'k');
eq(vim.visualMode, true);
}, { value: '\n' });
testVim('macro_q_as_argument_does_not_end_recording', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('q', 'a', 'f', 'q', 'x', 'q');
eq('abqc', cm.getValue());
helpers.doKeys('@', 'a');
eq('abc', cm.getValue());
}, { value: 'aqbqc' });
testVim('reselect_visual', function(cm, vim, helpers) {
helpers.doKeys('l', 'v', 'l', 'l', 'l', 'y', 'g', 'v');
helpers.assertCursorAt(0, 5);
Expand Down
5 changes: 4 additions & 1 deletion packages/codemirror-vim-core/vim.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,10 @@ export function initVim(CM) {
function handleMacroRecording() {
var macroModeState = vimGlobalState.macroModeState;
if (macroModeState.isRecording) {
if (key == 'q') {
// A `q` ends the recording only as a command of its own, not as the
// character a pending key is waiting for (`fq`, `"qp`, `@q`, `iq`).
// A count before it changes nothing.
if (key == 'q' && !/\D/.test(vim.inputState.keyBuffer.join(''))) {
macroModeState.exitMacroRecordMode();
clearInputState(cm);
return true;
Expand Down