From: Scott Worley Date: Wed, 2 Mar 2022 00:23:45 +0000 (-0800) Subject: h/l to move between task nesting levels X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/cadeba34163d2dbdf4d97b40c4284a5d60b34fe7?ds=inline;hp=109d4bc26db6a0f5a6b6afd72446827d25fc334e h/l to move between task nesting levels --- 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);