]> git.scottworley.com Git - vopamoi/blobdiff - vopamoi.ts
'l' goes to first *visible* subtask
[vopamoi] / vopamoi.ts
index 695ddefa7361e560f244597a76cd73cf0f08f30e..8e7280964e076c45dc740cae6661e09ccaf6fe00 100644 (file)
@@ -297,9 +297,6 @@ function BrowserUI() {
         this.firstVisibleTask()?.focus();
       }
       input.value = "";
-      if (currentTagView) {
-        ui.addTag(task.getAttribute("data-created")!, currentTagView);
-      }
       if (event.getModifierState("Control")) {
         this.makeBottomPriority(task);
       }
@@ -381,8 +378,9 @@ function BrowserUI() {
       return target as HTMLElement;
     },
 
-    firstVisibleTask: function () {
-      for (const task of document.getElementsByClassName("task")) {
+    firstVisibleTask: function (root: Element | null = null) {
+      if (root === null) root = document.body;
+      for (const task of root.getElementsByClassName("task")) {
         const state = task.getAttribute("data-state");
         if (
           task instanceof HTMLElement &&
@@ -450,7 +448,9 @@ function BrowserUI() {
     },
 
     moveCursorRight: function () {
-      (this.currentTask()?.getElementsByClassName("task")[0] as HTMLElement)?.focus();
+      const active = this.currentTask();
+      if (!active) return false;
+      (this.firstVisibleTask(active) as HTMLElement | null)?.focus();
     },
 
     moveCursorVertically: function (offset: number): boolean {