fix count handling for dd and yy
This commit is contained in:
parent
614a0b57d1
commit
03ef921536
1 changed files with 8 additions and 4 deletions
|
|
@ -327,15 +327,19 @@ var inputBuffer = exports.inputBuffer = {
|
||||||
lastInsertCommands: [],
|
lastInsertCommands: [],
|
||||||
|
|
||||||
push: function(editor, ch, keyId) {
|
push: function(editor, ch, keyId) {
|
||||||
|
var status = this.status;
|
||||||
var isKeyHandled = true;
|
var isKeyHandled = true;
|
||||||
this.idle = false;
|
this.idle = false;
|
||||||
var wObj = this.waitingForParam;
|
var wObj = this.waitingForParam;
|
||||||
|
if (/^numpad\d+$/i.test(ch))
|
||||||
|
ch = ch.substr(6);
|
||||||
|
|
||||||
if (wObj) {
|
if (wObj) {
|
||||||
this.exec(editor, wObj, ch);
|
this.exec(editor, wObj, ch);
|
||||||
}
|
}
|
||||||
// If input is a number (that doesn't start with 0)
|
// If input is a number (that doesn't start with 0)
|
||||||
else if (!(ch === "0" && !this.currentCount.length) &&
|
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
|
// Assuming that ch is always of type String, and not Number
|
||||||
this.currentCount += ch;
|
this.currentCount += ch;
|
||||||
this.currentCmd = NUMBER;
|
this.currentCmd = NUMBER;
|
||||||
|
|
@ -389,6 +393,7 @@ var inputBuffer = exports.inputBuffer = {
|
||||||
this.idle = false;
|
this.idle = false;
|
||||||
}
|
}
|
||||||
else if (this.operator) {
|
else if (this.operator) {
|
||||||
|
this.operator.count = this.getCount();
|
||||||
this.exec(editor, { operator: this.operator }, ch);
|
this.exec(editor, { operator: this.operator }, ch);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -402,10 +407,9 @@ var inputBuffer = exports.inputBuffer = {
|
||||||
this.status = this.currentCount;
|
this.status = this.currentCount;
|
||||||
} else if (this.status) {
|
} else if (this.status) {
|
||||||
this.status = "";
|
this.status = "";
|
||||||
} else {
|
|
||||||
return isKeyHandled;
|
|
||||||
}
|
}
|
||||||
editor._emit("changeStatus");
|
if (this.status != status)
|
||||||
|
editor._emit("changeStatus");
|
||||||
return isKeyHandled;
|
return isKeyHandled;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue