From cadeba34163d2dbdf4d97b40c4284a5d60b34fe7 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Tue, 1 Mar 2022 16:23:45 -0800 Subject: [PATCH] h/l to move between task nesting levels --- vopamoi.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vopamoi.ts b/vopamoi.ts index 302307f..695ddef 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -441,6 +441,18 @@ function BrowserUI() { task instanceof HTMLElement && task.focus(); }, + moveCursorLeft: function () { + const active = this.currentTask(); + if (!active) return false; + if (active.parentElement!.classList.contains("task")) { + active.parentElement!.focus(); + } + }, + + moveCursorRight: function () { + (this.currentTask()?.getElementsByClassName("task")[0] as HTMLElement)?.focus(); + }, + moveCursorVertically: function (offset: number): boolean { const active = this.currentTask(); if (!active) return false; @@ -643,6 +655,8 @@ function handleKey(event: any) { if (event.key == "e") return window.scrollBy(0, (inputCount ?? 1) * scrollIncrement); if (event.key == "y") return window.scrollBy(0, (inputCount ?? 1) * -scrollIncrement); } else { + if (event.key == "h") return browserUI.moveCursorLeft(); + if (event.key == "l") return browserUI.moveCursorRight(); if (event.key == "j") return browserUI.moveCursorVertically(inputCount ?? 1); if (event.key == "k") return browserUI.moveCursorVertically(-(inputCount ?? 1)); if (event.key == "J") return browserUI.moveTask(inputCount ?? 1); -- 2.44.1