X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/f1d8d0edea19b119dc4e3e4732c79e3dd2102b4d..bb25aeb64a51985374e378cd10e70e683be004f6:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index d3b2c05..9137ff5 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; @@ -505,6 +512,7 @@ function handleKey(event: any) { if (event.key == "Escape") return browserUI.completeEdit(event, CommitOrAbort.Abort); } } else { + if (event.ctrlKey) return; // eg: Don't redo when user refreshes the page with ctrl-R if (inputState === InputState.Root) { if ("0" <= event.key && event.key <= "9") { return (inputCount = (inputCount ?? 0) * 10 + parseInt(event.key)); @@ -514,6 +522,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");