fix count handling for dd and yy

This commit is contained in:
nightwing 2013-02-11 11:39:41 +04:00
commit 03ef921536

View file

@ -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;
},