mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
hotkey: Move ctrl+[ back from cmd+[.
This was incorrectly changed; the goal here is to match what vim does for this keyboard shortcut. Fixes #9525.
This commit is contained in:
@@ -123,7 +123,8 @@ run_test('mappings', () => {
|
||||
|
||||
// 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";
|
||||
assert.equal(map_down(219, false, false, true).name, 'escape'); // cmd + [
|
||||
assert.equal(map_down(219, false, true, false).name, 'escape'); // ctrl + [
|
||||
assert.equal(map_down(219, false, false, true), undefined); // cmd + [
|
||||
assert.equal(map_down(75, false, false, true).name, 'search_with_k'); // cmd + k
|
||||
|
||||
assert.equal(map_down(75, false, true, false), undefined); // ctrl + k
|
||||
|
||||
@@ -47,9 +47,12 @@ var keydown_unshift_mappings = {
|
||||
40: {name: 'down_arrow', message_view_only: false}, // down arrow
|
||||
};
|
||||
|
||||
var keydown_ctrl_mappings = {
|
||||
219: {name: 'escape', message_view_only: false}, // '['
|
||||
};
|
||||
|
||||
var keydown_cmd_or_ctrl_mappings = {
|
||||
75: {name: 'search_with_k', message_view_only: false}, // 'K'
|
||||
219: {name: 'escape', message_view_only: false}, // '['
|
||||
};
|
||||
|
||||
var keydown_either_mappings = {
|
||||
@@ -113,6 +116,13 @@ exports.get_keydown_hotkey = function (e) {
|
||||
|
||||
var hotkey;
|
||||
|
||||
if (e.ctrlKey) {
|
||||
hotkey = keydown_ctrl_mappings[e.which];
|
||||
if (hotkey) {
|
||||
return hotkey;
|
||||
}
|
||||
}
|
||||
|
||||
var isCmdOrCtrl = /Mac/i.test(navigator.userAgent) ? e.metaKey : e.ctrlKey;
|
||||
if (isCmdOrCtrl) {
|
||||
hotkey = keydown_cmd_or_ctrl_mappings[e.which];
|
||||
|
||||
Reference in New Issue
Block a user