From: Scott Worley Date: Sat, 29 Jan 2022 20:46:36 +0000 (-0800) Subject: vi-style count-prefix for task movement X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/f1d8d0edea19b119dc4e3e4732c79e3dd2102b4d?ds=sidebyside vi-style count-prefix for task movement --- diff --git a/vopamoi.ts b/vopamoi.ts index 3ccc562..d3b2c05 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -492,6 +492,7 @@ var inputState = InputState.Root; var inputCount: number | null = null; function handleKey(event: any) { + if (["Alt", "Control", "Meta", "Shift"].includes(event.key)) return; if (event.target.tagName === "INPUT") { if (event.target.id === "taskName") { if (event.key == "Enter") return browserUI.addTask(event); @@ -511,8 +512,8 @@ function handleKey(event: any) { try { if (event.key == "j") return browserUI.moveCursor(inputCount ?? 1); if (event.key == "k") return browserUI.moveCursor(-(inputCount ?? 1)); - if (event.key == "J") return browserUI.moveTask(1); - if (event.key == "K") return browserUI.moveTask(-1); + if (event.key == "J") return browserUI.moveTask(inputCount ?? 1); + if (event.key == "K") return browserUI.moveTask(-(inputCount ?? 1)); if (event.key == "T") return browserUI.makeTopPriority(); if (event.key == "n") return browserUI.focusTaskNameInput(event); if (event.key == "c") return browserUI.setState("cancelled");