Add keyboard shortcuts - #116
Merged
Merged
Conversation
Enable keyboard row navigation and shift-range selection in the file explorer, plus terminal font zoom shortcuts. - ExplorerFileTable: handle ArrowUp/ArrowDown to move focus between rows, support Shift+Arrow for range selection, scroll focused row into view, and update selection state. Also tidy aria-sort/JSX formatting and minor data-entry-perms/size rendering adjustments. - AppShell: introduce preZoomFontSizeRef and add Meta+=, Meta+-, Meta+0 shortcuts to increase, decrease, and reset terminal font size (active only on terminal tabs). Close macnev2013#104
- Meta+0 is a no-op when no zoom is active instead of clobbering the configured terminal font size with a hard-coded default - sortedEntries and its id list are memoized so arrow-key navigation no longer rebuilds an array per keypress in large directories
macnev2013
force-pushed
the
add/key-shortcut
branch
from
July 25, 2026 09:42
51a6c51 to
5eb960b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable keyboard row navigation and shift-range selection in the file explorer, plus terminal font zoom shortcuts.
Close #104
Greptile Summary
This PR adds two keyboard-shortcut features: row-level Arrow navigation and Shift+Arrow range selection in the file explorer, and
Meta+=/Meta+-/Meta+0terminal font zoom shortcuts in the app shell. It also memoisessortedEntriesand the derivedsortedIdsarray to avoid rebuilding them on every keypress.Shift+Arrowbuilds a range selection anchored atlastClickedId;sortedEntriesandsortedIdsare wrapped inuseMemo; additional changes are formatting-only.preZoomFontSizeRefstores the font size before the first zoom step soMeta+0can restore it; the ref is initialised tonulland Meta+0 exits early when no zoom session is active, addressing a previous issue where it would hard-code 14 as the reset value.Confidence Score: 5/5
Safe to merge; both feature areas are well-scoped and the previously reported regressions are resolved.
The keyboard navigation in the file explorer is straightforward DOM-sibling walking with a correctly memoised ID list. The font-zoom logic guards the pre-zoom ref properly and exits early on Meta+0 when nothing is zoomed. The two remaining observations (Cmd++ not covered, stale baseline on mid-session Settings change) are edge-case UX gaps rather than data-loss or crash conditions.
Files Needing Attention: AppShell.tsx — the zoom-baseline ref is the only place that could produce a surprising font-size reset.
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant KeyboardHandler as useKeyboardShortcuts participant AppShell participant SettingsStore Note over User,SettingsStore: Terminal Font Zoom (AppShell) User->>KeyboardHandler: "Meta+=" KeyboardHandler->>AppShell: action() AppShell->>SettingsStore: getState().terminalFontSize AppShell->>AppShell: "preZoomFontSizeRef.current = fontSize (if null)" AppShell->>SettingsStore: setTerminalFontSize(fontSize + 1) User->>KeyboardHandler: Meta+0 KeyboardHandler->>AppShell: action() AppShell->>AppShell: "if preZoomFontSizeRef.current === null return" AppShell->>SettingsStore: setTerminalFontSize(preZoomFontSizeRef.current) AppShell->>AppShell: "preZoomFontSizeRef.current = null" Note over User,SettingsStore: Explorer Arrow Navigation (ExplorerFileTable) User->>KeyboardHandler: ArrowDown / ArrowUp (on row) KeyboardHandler->>KeyboardHandler: lookup nextIdx in sortedIds alt no Shift KeyboardHandler->>KeyboardHandler: setSelectedIds(nextId) KeyboardHandler->>KeyboardHandler: "lastClickedId = nextId" else Shift held KeyboardHandler->>KeyboardHandler: "anchor = lastClickedId or entry.id" KeyboardHandler->>KeyboardHandler: setSelectedIds(range anchor to next) end KeyboardHandler->>KeyboardHandler: nextRow.focus() + scrollIntoView()Reviews (3): Last reviewed commit: "fix: address review — safe Meta+0 reset ..." | Re-trigger Greptile