diff options
author | Andrew Dolgov <[email protected]> | 2019-03-14 09:08:52 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-03-14 09:08:52 +0300 |
commit | b1bb7c6001c9a2c7c636674c110ccfdd5a09cd7e (patch) | |
tree | 82a53b581b0a4012bccb71901685e0039a84627c /js/AppBase.js | |
parent | 019f4578bcb80069487c4dff7ec5c05f35b0eacd (diff) | |
parent | 63d7705b7fbe980bfc4e8c7f01b38e80b3c68928 (diff) |
Merge branch 'master' of git.fakecake.org:tt-rss
Diffstat (limited to 'js/AppBase.js')
-rw-r--r-- | js/AppBase.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/js/AppBase.js b/js/AppBase.js index 121b7aa85..a5e20b8f9 100644 --- a/js/AppBase.js +++ b/js/AppBase.js @@ -60,14 +60,12 @@ define(["dojo/_base/declare"], function (declare) { const hotkeys_map = App.getInitParam("hotkeys"); const keycode = event.which; - const keychar = String.fromCharCode(keycode).toLowerCase(); + const keychar = String.fromCharCode(keycode); if (keycode == 27) { // escape and drop prefix this.hotkey_prefix = false; } - if (keycode == 16 || keycode == 17) return; // ignore lone shift / ctrl - if (!this.hotkey_prefix && hotkeys_map[0].indexOf(keychar) != -1) { this.hotkey_prefix = keychar; @@ -87,13 +85,19 @@ define(["dojo/_base/declare"], function (declare) { Element.hide("cmdline"); - let hotkey_name = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")"; + let hotkey_name = ""; + + if (event.type == "keydown") { + hotkey_name = "(" + keycode + ")"; - // ensure ^*char notation - if (event.shiftKey) hotkey_name = "*" + hotkey_name; - if (event.ctrlKey) hotkey_name = "^" + hotkey_name; - if (event.altKey) hotkey_name = "+" + hotkey_name; - if (event.metaKey) hotkey_name = "%" + hotkey_name; + // ensure ^*char notation + if (event.shiftKey) hotkey_name = "*" + hotkey_name; + if (event.ctrlKey) hotkey_name = "^" + hotkey_name; + if (event.altKey) hotkey_name = "+" + hotkey_name; + if (event.metaKey) hotkey_name = "%" + hotkey_name; + } else { + hotkey_name = keychar ? keychar : "(" + keycode + ")"; + } const hotkey_full = this.hotkey_prefix ? this.hotkey_prefix + " " + hotkey_name : hotkey_name; this.hotkey_prefix = false; |