summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/keymap
diff options
context:
space:
mode:
authorWu Cheng-Han2016-10-10 21:15:29 +0800
committerWu Cheng-Han2016-10-10 21:15:29 +0800
commit795ea21191486a80437d7c535defc503962c5968 (patch)
tree434a65ec986264b2abdec29b8f6a837ca536d2dd /public/vendor/codemirror/keymap
parentfb5d7e43592c1a14831067e28def9c4b9e2a97ca (diff)
Update CodeMirror to 5.19.0 and rename jade to pug
Diffstat (limited to 'public/vendor/codemirror/keymap')
-rw-r--r--public/vendor/codemirror/keymap/vim.js20
1 files changed, 16 insertions, 4 deletions
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;
}