Improve vim-mode to catch input better if in 'start' mode

This commit is contained in:
Julian Viereck 2010-12-22 22:43:11 +01:00
commit ffca65d15e
2 changed files with 19 additions and 10 deletions

View file

@ -165,9 +165,11 @@ KeyboardStateMapper.prototype = {
if (binding.then) {
data.state = binding.then;
data.buffer = "";
if (result.command == null) {
result.command = "null";
}
}
// If no command is set, then execute the "null" fake command.
if (result.command == null) {
result.command = "null";
}
return true;

View file

@ -94,15 +94,22 @@ var vimStates = {
]
},
{
comment: "Let all combos of Command, Ctrl, Optional pass...",
comment: "Catch some keyboard input to stop it here",
match: function(buffer, hashId, key, symbolicName) {
return hashId != 0 && !(hashId & 4);
// If no command keys are pressed, then catch the input.
if (hashId == 0) {
return true;
}
// If only the shift key is pressed and a character key, then
// catch that input as well.
else if ((hashId == 4) && key.length == 1) {
return true;
}
// Otherwise, we let the input got through.
else {
return false;
}
}
},
{
comment: "...but stop all other input!",
key: ".*",
exec: "null"
}
],
insertMode: [