From 795ea21191486a80437d7c535defc503962c5968 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 10 Oct 2016 21:15:29 +0800 Subject: Update CodeMirror to 5.19.0 and rename jade to pug --- public/vendor/codemirror/keymap/vim.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'public/vendor/codemirror/keymap') diff --git a/public/vendor/codemirror/keymap/vim.js b/public/vendor/codemirror/keymap/vim.js index afed132e..a166f72b 100644 --- a/public/vendor/codemirror/keymap/vim.js +++ b/public/vendor/codemirror/keymap/vim.js @@ -780,8 +780,12 @@ if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } if (keysAreChars) { - var here = cm.getCursor(); - cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input'); + var selections = cm.listSelections(); + for (var i = 0; i < selections.length; i++) { + var here = selections[i].head; + cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input'); + } + vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop(); } clearInputState(cm); return match.command; @@ -818,7 +822,7 @@ // TODO: Look into using CodeMirror's multi-key handling. // Return no-op since we are caching the key. Counts as handled, but // don't want act on it just yet. - return function() {}; + return function() { return true; }; } else { return function() { return cm.operation(function() { @@ -4874,6 +4878,10 @@ if (changeObj.origin == '+input' || changeObj.origin == 'paste' || changeObj.origin === undefined /* only in testing */) { var text = changeObj.text.join('\n'); + if (lastChange.maybeReset) { + lastChange.changes = []; + lastChange.maybeReset = false; + } lastChange.changes.push(text); } // Change objects may be chained with next. @@ -4896,7 +4904,7 @@ lastChange.expectCursorActivityForChange = false; } else { // Cursor moved outside the context of an edit. Reset the change. - lastChange.changes = []; + lastChange.maybeReset = true; } } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); @@ -4960,6 +4968,10 @@ var keyName = CodeMirror.keyName(e); if (!keyName) { return; } function onKeyFound() { + if (lastChange.maybeReset) { + lastChange.changes = []; + lastChange.maybeReset = false; + } lastChange.changes.push(new InsertModeKey(keyName)); return true; } -- cgit v1.2.3