hotkeys: Deactivate `cmd-or-ctrl + shift` hotkeys.

This disables `cmd-or-ctrl + shift + k` and `cmd-or-ctrl + shift + s`,
while `cmd-or-ctrl + k` and `cmd-or-ctrl + s` will still trigger
actions.

Also, add tests for ensuring that the `cmd-or-ctrl + shift`
combinations fall through.

Fix #9779.
This commit is contained in:
Marco Burstein 2018-06-20 09:43:01 -07:00 committed by showell
parent af5de189d8
commit 56f711d5ff
2 changed files with 3 additions and 1 deletions

View File

@ -121,6 +121,8 @@ run_test('mappings', () => {
assert.equal(map_down(77, false, true), undefined); // ctrl + m
assert.equal(map_down(75, false, false, true), undefined); // cmd + k
assert.equal(map_down(83, false, false, true), undefined); // cmd + s
assert.equal(map_down(75, true, true), undefined); // shift + ctrl + k
assert.equal(map_down(83, true, true), undefined); // shift + ctrl + s
// CMD tests for MacOS
global.navigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36";

View File

@ -126,7 +126,7 @@ exports.get_keydown_hotkey = function (e) {
}
var isCmdOrCtrl = /Mac/i.test(navigator.userAgent) ? e.metaKey : e.ctrlKey;
if (isCmdOrCtrl) {
if (isCmdOrCtrl && !e.shiftKey) {
hotkey = keydown_cmd_or_ctrl_mappings[e.which];
if (hotkey) {
return hotkey;