fix(ui): enable j/k step scroll in normal mode#131
Conversation
Greptile SummaryThis is a small, focused fix that closes the
Confidence Score: 5/5Safe to merge — the change is minimal, well-scoped, and correctly reuses an existing abstraction. Only one file changes, the fix is two lines, the No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
K[Key event received] --> DEF[Define stepUpKey / stepDownKey\nup · k / down · j]
DEF --> PM{pagerMode?}
PM -- yes --> PS[stepUpKey → scrollDiff -1 step\nstepDownKey → scrollDiff +1 step]
PM -- no --> AM{activeMenuId?}
AM -- yes, captures up/down/etc. --> MENU[Menu navigation / action]
AM -- j or k falls through --> STEP
AM -- no --> FF[focusArea, q, ?, escape…]
FF --> STEP["stepUpKey → scrollDiff -1 step ✅ NEW\nstepDownKey → scrollDiff +1 step ✅ NEW"]
Reviews (1): Last reviewed commit: "fix(ui): enable j/k step scroll in norma..." | Re-trigger Greptile |
| if (stepUpKey) { | ||
| scrollDiff(-1, "step"); | ||
| return; | ||
| } | ||
|
|
||
| if (key.name === "down") { | ||
| if (stepDownKey) { | ||
| scrollDiff(1, "step"); | ||
| return; |
There was a problem hiding this comment.
j/k scroll through when a menu is open
With this change, pressing j or k while activeMenuId is set will fall through the menu block (which only captures up/down/left/right/tab/enter/escape) and reach the new stepDownKey/stepUpKey checks, silently scrolling the diff in the background while the menu is open.
Before this PR, j and k were no-ops in the menu context. This is now a behaviour change. The menu item navigation on lines 717–724 uses key.name === "up" / key.name === "down" directly, so j/k will never navigate menu items — they'll just scroll.
Whether this is intentional is worth a quick sanity-check. If the menu should fully consume all input while open, adding an early return at the end of the activeMenuId block would prevent unintended fall-through for all non-captured keys (not just the scrolling ones).
|
@aliou Nice find, I never actually use these so never noticed! |
Hello!
Noticed this mismatch when I couldn't undersatnd why
j/kwould work in some case and not others.Let me know if you need/want other changes!
summary by gpt 5.3
Summary
Enable
j/kline-step scrolling in normal diff mode by reusing the existing shared step-key detection already used in pager mode.Changes
src/ui/App.tsxkeyboard handler in normal mode:upstep scroll condition now usesstepUpKeydownstep scroll condition now usesstepDownKeystepUpKeyincludesup+kstepDownKeyincludesdown+jWhy
j/kwere already supported in pager mode but not in normal mode due to direct arrow-key checks in the normal-mode branch. This caused inconsistent navigation behavior across modes.Validation
bun run typecheckhunk show HEAD~6):j/kno-op in normal modej/kscroll line-by-line in normal modeNotes