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) { if (count) {
data.count = count; data.count = count;
return {command: "null"}; 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; data.universalArgument = false;
@ -288,6 +292,7 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
if (data.count) { if (data.count) {
var count = data.count; var count = data.count;
data.count = 0; data.count = 0;
if (!command || !command.handlesCount) {
return { return {
args: args, args: args,
command: { command: {
@ -297,6 +302,10 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
} }
} }
}; };
} else {
if (!args) args = {}
if (typeof args === 'object') args.count = count;
}
} }
return {command: command, args: args}; return {command: command, args: args};