From: Scott Worley Date: Sat, 29 Jan 2022 20:57:13 +0000 (-0800) Subject: "G" to Go to the count-prefixed line. eg: "1G" to go to the top X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/40025d1248bf8a26e5f25d2720f9411a5fa1ded3?hp=f1d8d0edea19b119dc4e3e4732c79e3dd2102b4d "G" to Go to the count-prefixed line. eg: "1G" to go to the top --- diff --git a/vopamoi.ts b/vopamoi.ts index d3b2c05..7d2f3ee 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -378,6 +378,13 @@ function BrowserUI() { return valid_cursor; }, + jumpCursor: function (position: number) { + const first = this.firstVisibleTask(); + if (!first) return; + const dest = this.visibleTaskAtOffset(first, position - 1); + if (dest instanceof HTMLElement) dest.focus(); + }, + makeTopPriority: function (task: Element | null = null) { if (!task) task = document.activeElement; if (!task) return; @@ -514,6 +521,7 @@ function handleKey(event: any) { if (event.key == "k") return browserUI.moveCursor(-(inputCount ?? 1)); if (event.key == "J") return browserUI.moveTask(inputCount ?? 1); if (event.key == "K") return browserUI.moveTask(-(inputCount ?? 1)); + if (event.key == "G") return browserUI.jumpCursor(inputCount ?? MAX_SAFE_INTEGER); if (event.key == "T") return browserUI.makeTopPriority(); if (event.key == "n") return browserUI.focusTaskNameInput(event); if (event.key == "c") return browserUI.setState("cancelled");