Registry Mirror
Skip to content

Conversation

@bottercode

Copy link
Copy Markdown
Contributor

Problem

Since #1118, binary files can't be selected in the terminal review. ./, (next/previous file) jump over them, and clicking one in the files pane does nothing. This includes images, PDFs, and any other file Hunk renders as "Binary file skipped".

It shipped in 0.24.0-beta.0. 0.23.0 is not affected. To reproduce in this repository:

bunx hunkdiff@0.24.0-beta.0 show a3321c82   # the logo commit: two changed PNGs among 12 files

Press . repeatedly: the selection never stops on website/public/apple-icon.png or website/public/icon.png. Clicking icon.png in the files pane leaves the selection where it was.

Cause

#1118 made the terminal build its own navigation projection (projectedNavigationFiles in useTerminalReview.ts). That projection drops every file whose hunk list is empty, and binary or skipped files never have hunks:

  • file moves step through the projection, so ./, pass over them;
  • selectVisibleFile, which files-pane clicks use, returns early when the file has no first hunk.

The core file-jump rule already expects these files: planFileMove falls back to REVIEW_FILE_JUMP_HUNK_INDEX when a file has no hunk indexes.

Fix

  • Without a presentation scope, files with no hunks stay in the projection. File moves and clicks land on them; hunk moves ([/]) still pass over them because they contribute no cursors.
  • A presentation scope that gives a file no hunks still hides it, as before.
  • selectVisibleFile selects a hunkless file at REVIEW_FILE_JUMP_HUNK_INDEX, like the core file jump.

Non-goal: pressing ] while a binary file is selected jumps to the review's first hunk rather than the next one. That behavior predates #1118 and is unchanged here; it could be a separate follow-up.

Tests

  • useTerminalReview.test.tsx: file moves and selectVisibleFile reach a binary file between text files while hunk moves skip it; a presentation scope that omits the binary file still keeps it unreachable.
  • test/pty/nav.test.ts (new createBinaryNavigationRepoFixture): . lands on a binary file between two long text files, and clicking it in the files pane selects it.

Both new PTY tests and the new hook test fail without the change and pass with it.

Commands run

macOS (Darwin 25.5), Bun 1.4.3, branch rebased on 6aa52617. Not tested on Linux or Windows.

bun test packages/hunk/src/ui/hooks/useTerminalReview.test.tsx      # 63 pass
npm_execpath=$(command -v bun) bun test test/pty/nav.test.ts -t "binary|sidebar selection jumps"   # 3 pass
# same new tests with the hook change stashed: 1 hook test and both PTY tests fail
bun run typecheck      # pass
bun run lint           # pass
bun run format:check   # pass
bun run deps:check     # pass
bun run test           # 5028 pass, 55 skip, 10 fail (see below)
bun run test:integration   # 253 pass, 2 skip, 4 fail (see below)

Failures in the full runs, each checked on unmodified main (6aa52617):

  • bun run test: 9 failures in installedPackageResolution.test.ts (3), hostRuntimeModules.test.ts (4), manage/npm.test.ts (1) and AppHost.reload.test.tsx (1) fail identically on main on this machine; Main CI is green on the same commit, so they look environment-specific. The tenth, in filesystemSource.observe.test.ts, is an intermittent watcher timeout that fails about one run in three on main here.
  • bun run test:integration: the two status-integration.test.ts failures also fail on main. The comment-target.test.ts wheel-return test failed 2 of 6 runs on main and 0 of 6 on this branch. dialog-first-open-integration.test.ts ("opens help promptly after two seconds idle") failed once in the full run and passed when run alone on both main and this branch.

Manual check in Ghostty: with this branch, hunk show a3321c82 and . stop on all 12 files in order, including both PNGs, and clicking icon.png in the files pane selects it.

I found this while prototyping image previews for binary files as a file view, which needs image files to be selectable.

The presentation-scope projection added in modem-dev#1118 drops every file
without hunks from the terminal's navigation files. Binary and other
skipped files have no hunks, so `.`/`,` stepped over them and clicking
them in the files pane did nothing; selectVisibleFile also bailed out
when a file had no first hunk.

Unscoped files without hunks now stay in the navigation projection and
are selected at the shared file-jump index, matching the core file-jump
rule. Hunk moves still pass over them because they contribute no
cursors, and a presentation scope still hides files it gives no hunks.
@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

@bottercode is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@bottercode

Copy link
Copy Markdown
Contributor Author

CI note: the two failing checks are unrelated to this change.

  • Check and build website fails in changelog-smoke.spec.ts:97 ("Prerelease ·" count), the same as main on 6aa52617, the base of this branch: https://github.com/modem-dev/hunk/actions/runs/38346623326. This PR doesn't touch website/.
  • Vercel needs deploy authorization, which fork PRs don't have.

All code checks pass, including PTY integration and Windows.

@benvinegar
benvinegar merged commit d3543c6 into modem-dev:main Oct 13, 2026
13 of 15 checks 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