Skip to content

feat(ui): add , and . to move between files#7

Merged
amix merged 1 commit into
mainfrom
amix/file-nav-keys
May 16, 2026
Merged

feat(ui): add , and . to move between files#7
amix merged 1 commit into
mainfrom
amix/file-nav-keys

Conversation

@amix
Copy link
Copy Markdown
Owner

@amix amix commented May 16, 2026

Context

Backport of modem-dev/hunk#280. PR 3 of an expert-gated backport series.

[/]/J/K only step hunk-by-hunk, so skipping past a large file meant pressing through every one of its hunks. This adds whole-file navigation.

What was changed

  • , → previous file, . → next file, in review-stream order, clamped at the ends; the destination file lands at its header.
  • New clamped moveToFile(delta) on the review controller, reusing selectFile with header alignment. No-op at the edges and when the target is the current file, so a clamped press doesn't re-trigger a scroll/re-align.
  • Bound next to the [/] hunk-nav handlers; ? help gets a ", / ." row.
  • Adapted from upstream (dunk has no menu bar, so no runAndCloseMenu wrapper).

Expert-reviewed: implementation and input-context safety validated; incorporated the recommended filter-focus inertness PTY test and the symmetric backward-clamp unit assertion.

Verification

  • bun run typecheck, bun run lint: clean.
  • useReviewController.test.tsx: 3 pass — moveToFile forward (resets hunk index, bumps align id), clamp-at-last no-op, backward, clamp-at-first no-op (align id unchanged).
  • PTY integration: 23 pass, including a real-TTY ,/. file-jump test and a test asserting ,/. are inert while the filter is focused (printable keys must go to the filter, not navigate).

Out of scope

moveToAnnotatedFile stays cyclic; moveToFile is clamped — matches upstream intent and dunk's gg/G feel.

🤖 Generated with Claude Code

@amix amix force-pushed the amix/file-nav-keys branch from 1bbef42 to d538530 Compare May 16, 2026 19:40
@amix amix marked this pull request as ready for review May 16, 2026 19:41
`[`/`]`/`J`/`K` only step hunk-by-hunk, so skipping past a large file
meant pressing through every one of its hunks. `,` and `.` now jump to
the previous / next file in the review stream, clamped at the ends, and
land at the new file's header.

Adds a clamped `moveToFile(delta)` to the review controller (reusing
`selectFile` with header alignment, no-op at the edges so a clamped press
doesn't re-trigger a scroll), binds `,`/`.` next to the hunk-nav keys,
and documents both in `?` help.

Backports modem-dev/hunk#280, adapted to dunk (no menu-bar wrapper).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amix amix force-pushed the amix/file-nav-keys branch from d538530 to 3c8449c Compare May 16, 2026 19:44
@amix amix merged commit 09c6d75 into main May 16, 2026
2 checks passed
@amix amix deleted the amix/file-nav-keys branch May 16, 2026 19:47
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.

1 participant