fix +13674 . command doesn't handle backspace in vim mode

pull/299/head
nightwing 2016-04-29 01:41:40 +04:00
rodzic c9a1efeeaa
commit 2faf44658c
1 zmienionych plików z 18 dodań i 12 usunięć

30
node_modules/ace/lib/ace/keyboard/vim.js wygenerowano vendored
Wyświetl plik

@ -154,17 +154,15 @@ define(function(require, exports, module) {
return this.ace.inVirtualSelectionMode && this.ace.selection.index;
};
this.onChange = function(delta) {
if (delta.action[0] == 'i') {
var change = { text: delta.lines };
var curOp = this.curOp = this.curOp || {};
if (!curOp.changeHandlers)
curOp.changeHandlers = this._eventRegistry["change"] && this._eventRegistry["change"].slice();
if (this.virtualSelectionMode()) return;
if (!curOp.lastChange) {
curOp.lastChange = curOp.change = change;
} else {
curOp.lastChange.next = curOp.lastChange = change;
}
var change = { text: delta.action[0] == 'i' ? delta.lines : [] };
var curOp = this.curOp = this.curOp || {};
if (!curOp.changeHandlers)
curOp.changeHandlers = this._eventRegistry["change"] && this._eventRegistry["change"].slice();
if (this.virtualSelectionMode()) return;
if (!curOp.lastChange) {
curOp.lastChange = curOp.change = change;
} else {
curOp.lastChange.next = curOp.lastChange = change;
}
this.$updateMarkers(delta);
};
@ -5693,6 +5691,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
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.
@ -5715,7 +5717,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
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);
@ -5779,6 +5781,10 @@ dom.importCssString(".normal-mode .ace_cursor{\
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;
}