Skip to content

walkthrough: vim-style line cursor (j/k/Ctrl-d/Ctrl-u/gg/G/c)#9

Merged
tomplex merged 2 commits into
tomplex:mainfrom
brendanwhit:brendanwhit/walkthrough-vim
May 19, 2026
Merged

walkthrough: vim-style line cursor (j/k/Ctrl-d/Ctrl-u/gg/G/c)#9
tomplex merged 2 commits into
tomplex:mainfrom
brendanwhit:brendanwhit/walkthrough-vim

Conversation

@brendanwhit
Copy link
Copy Markdown
Contributor

Summary

Adds keyboard-driven line navigation to walkthrough mode so a reviewer can scan a stop without their hands leaving the keyboard.

Key Action
j / k Move cursor down / up one focusable diff line
Ctrl-d / Ctrl-u Half-viewport jumps
gg / G First / last focusable line of stop
c Open comment composer on focused line

Existing bindings (Enter, Shift+Enter, g<1-9>, d, W, ?) unchanged. The new keys are scoped to walkthrough mode only; diff-mode bindings (j/k for the sidebar, c for commit picker) are untouched because the walkthrough block in useKeyboardShortcuts.ts early-returns before reaching them.

Focus model

A walkthroughCursor signal tracks { artifactIdx, rowIdx } for the active stop. rowIdx indexes only diff rows (line.type !== 'hunk'); hunk markers, the stop title, and the narrative scroll past silently. The cursor resets on stop change so j after Enter starts at the top of the next stop.

The focused row gets a 3px left-edge gutter bar and an 8% accent-tinted background, composited over the existing add/del/context colors. A createEffect in Stop.tsx calls scrollIntoView({ block: 'nearest' }) when the cursor moves, so manual scroll between keypresses isn't yanked.

c works by setting a one-shot commentTrigger signal that DiffLine watches — same code path as a mouse click on the row.

Test plan

  • 14 unit tests for the cursor helpers (`walkthrough-cursor.test.ts`)
  • Full suite passes (`npm test` → 233 passed, 9 skipped)
  • `npm run lint` / `format:check` / `build` clean
  • Manual: exercise j/k/gg/G/Ctrl-d/Ctrl-u/c in walkthrough mode; confirm Enter still advances stops and resets cursor; mouse click still opens comments

🤖 Generated with Claude Code

@tomplex tomplex closed this May 19, 2026
@tomplex tomplex reopened this May 19, 2026
@tomplex tomplex merged commit d40b6af into tomplex:main May 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants