drafts: Allow vim up and down key to scroll between drafts.

Added a fix to bind vim_up(k) and vim_down(j) keys
with the draft section, allowing users to scroll
between the drafts using 'k' (scroll up) and
'j'(scroll down) keys.

Fixes #18397
This commit is contained in:
aryanshridhar
2021-05-08 18:52:44 +05:30
committed by Tim Abbott
parent c25155a143
commit 9f15de41f3
2 changed files with 4 additions and 2 deletions

View File

@@ -471,13 +471,13 @@ export function drafts_handle_events(e, event_key) {
// This detects up arrow key presses when the draft overlay // This detects up arrow key presses when the draft overlay
// is open and scrolls through the drafts. // is open and scrolls through the drafts.
if (event_key === "up_arrow") { if (event_key === "up_arrow" || event_key === "vim_up") {
drafts_scroll(row_before_focus()); drafts_scroll(row_before_focus());
} }
// This detects down arrow key presses when the draft overlay // This detects down arrow key presses when the draft overlay
// is open and scrolls through the drafts. // is open and scrolls through the drafts.
if (event_key === "down_arrow") { if (event_key === "down_arrow" || event_key === "vim_down") {
drafts_scroll(row_after_focus()); drafts_scroll(row_after_focus());
} }

View File

@@ -569,6 +569,8 @@ export function process_hotkey(e, hotkey) {
switch (event_name) { switch (event_name) {
case "up_arrow": case "up_arrow":
case "down_arrow": case "down_arrow":
case "vim_up":
case "vim_down":
case "backspace": case "backspace":
case "delete": case "delete":
if (overlays.drafts_open()) { if (overlays.drafts_open()) {