emacs: fix handling of universalArgument, it sets data.count to 4

This commit is contained in:
Robert Krahn 2013-05-26 21:03:12 -07:00
commit ab2021bdd8

View file

@ -231,6 +231,10 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (count) {
data.count = count;
return {command: "null"};
} else if (data.universalArgument) {
// if no number pressed use emacs defaults for universalArgument
// which is 4
data.count = 4;
}
}
data.universalArgument = false;
@ -288,15 +292,20 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (data.count) {
var count = data.count;
data.count = 0;
return {
args: args,
command: {
exec: function(editor, args) {
for (var i = 0; i < count; i++)
command.exec(editor, args);
if (!command || !command.handlesCount) {
return {
args: args,
command: {
exec: function(editor, args) {
for (var i = 0; i < count; i++)
command.exec(editor, args);
}
}
}
};
};
} else {
if (!args) args = {}
if (typeof args === 'object') args.count = count;
}
}
return {command: command, args: args};