]> git.scottworley.com Git - vopamoi/commitdiff
j/k should select something if there's no selected task
authorScott Worley <scottworley@scottworley.com>
Fri, 20 Oct 2023 19:57:33 +0000 (12:57 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 20 Oct 2023 20:11:19 +0000 (13:11 -0700)
vopamoi.ts

index 0389a04c2a25f0e00305f3f0232ae366dc86c597..30efb1b2f47dc5999e1f3635be343f8ba6ed4bb0 100644 (file)
@@ -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) {