Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

inbox: Add support for vim keys.

Aman Agrawala8e1c22687e3
diff --git a/web/src/hotkey.js b/web/src/hotkey.js
index 75a325a1090..44787b4a57d 100644
--- a/web/src/hotkey.js
+++ b/web/src/hotkey.js
@@ -652,6 +652,10 @@ export function process_hotkey(e, hotkey) {
case "tab":
case "shift_tab":
case "escape":
+ case "vim_up":
+ case "vim_down":
+ case "vim_left":
+ case "vim_right":
if (inbox_util.is_in_focus()) {
return inbox_ui.change_focused_element(event_name);
}
diff --git a/web/src/inbox_ui.js b/web/src/inbox_ui.js
index 13178286351..aa1637778ed 100644
--- a/web/src/inbox_ui.js
+++ b/web/src/inbox_ui.js
@@ -672,10 +672,12 @@ export function change_focused_element(input_key) {
}
} else {
switch (input_key) {
+ case "vim_down":
case "down_arrow":
row_focus += 1;
set_list_focus();
return true;
+ case "vim_up":
case "up_arrow":
if (row_focus === 0) {
set_default_focus();
@@ -684,11 +686,13 @@ export function change_focused_element(input_key) {
row_focus -= 1;
set_list_focus();
return true;
+ case "vim_right":
case "right_arrow":
case "tab":
col_focus += 1;
set_list_focus(input_key);
return true;
+ case "vim_left":
case "left_arrow":
case "shift_tab":
col_focus -= 1;