Skip to content

Commit

Permalink
Fix can't use Function keys as map key in .Vromerc
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Mar 16, 2012
1 parent b07fec1 commit cf2cfab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- [Open] Escape special characters when open a url (issue #117)
- [Open] Recognize "localhost" as valid URL (issue #118)
- [Open] Fix open part of the URL you inputed when you input very fast or search very slow (issue #116)
- [Vromerc] Fix can't use Function keys as map key in .Vromerc (issue #109)

1.0.3 (2012/03/06)

Expand Down
15 changes: 14 additions & 1 deletion src/frontend/modules/key-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var KeyEvent = (function() {
function filterKey(key, insertMode) {
var configure = Settings.get('background.configure');
var mode = insertMode ? 'imap' : 'map';
if (/\d/.test(key)) { return key; }
if (/^\d$/.test(key)) { return key; }
return (configure[mode] && configure[mode][key]) || key;
}

Expand Down Expand Up @@ -128,6 +128,19 @@ var KeyEvent = (function() {
var someBindingMatched = true;
}
}
// TODO Refact me
if ((someBindingMatched == undefined) && !keys.match(/^\d$/)) {
var configure = Settings.get('background.configure');
var mode = insertMode ? 'imap' : 'map';
if (configure[mode]) {
for (var i in configure[mode]) {
var regexp = new RegExp('^(' + keys.replace(/([(\[{\\^$|)?*+.])/g,"\\$1") + ')');
if (regexp.test(i)) {
var someBindingMatched = true;
}
}
}
}

// If any function invoked, then store it to last run command.
// (Don't do this when run repeat last command or In InsertMode)
Expand Down

0 comments on commit cf2cfab

Please sign in to comment.