diff --git a/lib/ace/keyboard/vim/commands.js b/lib/ace/keyboard/vim/commands.js index a081350c..52d8a271 100644 --- a/lib/ace/keyboard/vim/commands.js +++ b/lib/ace/keyboard/vim/commands.js @@ -327,15 +327,19 @@ var inputBuffer = exports.inputBuffer = { lastInsertCommands: [], push: function(editor, ch, keyId) { + var status = this.status; var isKeyHandled = true; this.idle = false; var wObj = this.waitingForParam; + if (/^numpad\d+$/i.test(ch)) + ch = ch.substr(6); + if (wObj) { this.exec(editor, wObj, ch); } // If input is a number (that doesn't start with 0) else if (!(ch === "0" && !this.currentCount.length) && - (ch.match(/^\d+$/) && this.isAccepting(NUMBER))) { + (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) { // Assuming that ch is always of type String, and not Number this.currentCount += ch; this.currentCmd = NUMBER; @@ -389,6 +393,7 @@ var inputBuffer = exports.inputBuffer = { this.idle = false; } else if (this.operator) { + this.operator.count = this.getCount(); this.exec(editor, { operator: this.operator }, ch); } else { @@ -402,10 +407,9 @@ var inputBuffer = exports.inputBuffer = { this.status = this.currentCount; } else if (this.status) { this.status = ""; - } else { - return isKeyHandled; } - editor._emit("changeStatus"); + if (this.status != status) + editor._emit("changeStatus"); return isKeyHandled; },