From 55c0520e11d12258f0913f11043fc402723339f8 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Fri, 20 Oct 2023 12:57:33 -0700 Subject: [PATCH] j/k should select something if there's no selected task --- vopamoi.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vopamoi.ts b/vopamoi.ts index 0389a04..30efb1b 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -446,6 +446,7 @@ function BrowserUI() { var target = document.activeElement; if (!target) return null; if (target.classList.contains("tag")) target = target.parentElement!; + if (!target.classList.contains("task")) return null; return target as HTMLElement; }, @@ -525,7 +526,11 @@ function BrowserUI() { }, moveCursorVertically: function (offset: number): boolean { - const active = this.currentTask(); + let active = this.currentTask(); + if (!active) { + this.firstVisibleTask()?.focus(); + active = this.currentTask(); + } if (!active) return false; const dest = this.visibleTaskAtOffset(active, offset); if (dest !== active && dest instanceof HTMLElement) { -- 2.44.1