From 40025d1248bf8a26e5f25d2720f9411a5fa1ded3 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Sat, 29 Jan 2022 12:57:13 -0800 Subject: [PATCH] "G" to Go to the count-prefixed line. eg: "1G" to go to the top --- vopamoi.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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"); -- 2.44.1