Skip to content

feat(web): read all changed files' diffs in one scroll, and find in them - #388

Merged
kalaspuff merged 3 commits into
mainfrom
fctl/691-after-clicking-on-a-file-in-the-file-lis
Nov 5, 2026
Merged

kalaspuff merged 3 commits into
mainfrom
fctl/691-after-clicking-on-a-file-in-the-file-lis

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The diff dialog showed one file at a time and left stray yellow focus rings behind. It now holds every changed file's diff, one after the other, in one scroll that opens at the file clicked. Each file has a header that stays at the top while its lines scroll, and can fold. All diffs come in one request (GET /sessions/{id}/diff, which fills each file's cache), and a file draws its lines once it comes near the view, so sessions with many files stay quick. The list beside the diffs marks the file in view and jumps to a file on a click.

  • Keys: j/k go from file to file. The arrow keys (and j/k, Home, End) move through the list, and the focus moves with them. n/p step from change to change across files. s and w still lay the diffs out side by side and wrap them.
  • Find: ⌘F (Ctrl+F elsewhere) opens a find bar over the diffs. It searches every file's lines, starting from where you are scrolled. Enter and Shift+Enter, ⌘G/⌘⇧G and F3 step through the matches. If you have scrolled away, the next step starts from where you are now. Alt+C, Alt+W and Alt+R turn on match case, whole word and regular expressions, as in VS Code, and a bad expression says what is wrong. Matches use the transcript find's highlights, the list counts them per file and dims files without any, and Escape closes the bar before the dialog.
  • Focus rings: the header's buttons no longer take the focus, so arrow keys keep scrolling the diffs. The list's rows show keyboard focus as their own inset outline. After the dialog closes, the row it was opened from by a click gets the focus back without the keyboard's ring. Tab still shows the ring as before.

Verified with unit tests: the search logic, the line keys matching parsePatch, and the dialog's keys, find, folding, bulk loading and focus return. I also drove it with Playwright in Chromium and WebKit against this repository's own #385 and #386 diffs (13 and 55 files): 55 files open in about 0.65 s with a simulated 200 ms network delay, and "diff" (894 matches) is found in about 75 ms. npm run check and the web tests pass. Docs: docs/llms.txt and the Changes paragraph of getting started describe the new keys.

Screenshots

Before: clicking a file in the list and pressing ↓ rings it in yellow; so does the next-file button after an arrow key, and the Changes row after the dialog closes.

before-dialog.png
before-next.png
before-rail.png

After, the same steps: ↓ in the list went on to the next file with no ring, the header's buttons have none, and the Changes row is quiet after closing.

after-dialog.png
after-next.png
after-rail.png

Finding "review" from docs/api.md: the match it is at in brand yellow, the others lighter, and the count per file in the list.

after-find.png

The light theme, side by side, while finding; and a phone, where the list covers the diffs while open.

after-light-split.png
after-phone.png

Worth confirming

  • Decision: / still focuses the list's file filter rather than the find bar, as it did before; ⌘F is the way into finding in the diffs.
  • Decision: a second ⌘F while the find bar has the focus opens the browser's own find, as the transcript's find does.
  • Decision: n/p are new keys for the next and previous change (a run of added or removed lines), across files.
  • Decision: matching is literal and ignores case unless a toggle says otherwise (like VS Code), unlike the transcript find, which also ignores accents and the amount of whitespace. Code search is more useful exact.

fctl session


Note

Low risk. It reworks the web app's diff dialog and adds a find bar; it changes no API, storage or server code, and only affects how the session page shows diffs.

What it does. Replaces the diff dialog's one-file-at-a-time view with a single scroll through every changed file's diff, fetched together with one GET /sessions/{id}/diff, plus a file list and a find bar (⌘F) that searches across all the diffs. The latest commit makes the find bar go to each step once and focus its field once per ⌘F, and scrolls the opened file's row into view in the list after the dialog shows.

Large rewrite. diff-dialog.tsx is rewritten and split into diff-files.tsx and diff-find.tsx; docs/architecture.md still describes the old per-file fetch.

fctl review's first look at 7306cfb · 13 files, +2255 −562 · Review agent settings

fctl-sh Bot added 2 commits November 5, 2026 21:21
…them

The diff dialog showed one file at a time: moving between files meant
stepping, and the browser's find saw only the file shown. It now holds
every changed file's diff one after the other, each under a header that
stays at the top while its lines scroll, and opens at the file clicked.
All diffs come in one request (GET /sessions/{id}/diff), which fills each
file's cache; files draw their lines as they come near the view.

The list of files beside them marks the one in view and goes to another
on a click; the arrow keys (and j/k) move through it with the focus. j/k
go from file to file anywhere in the dialog, n/p from change to change.
Cmd/Ctrl+F opens a find bar over the diffs that finds in every file's
lines from where the reader is: Enter and Shift+Enter, Cmd/Ctrl+G and F3
step through the matches, Alt+C/W/R match case, whole words and regular
expressions, Escape closes the bar and then the dialog. Matches light up
with the transcript find's highlights, and the list counts them per file.

The stray yellow focus rings are gone: the header's buttons leave the
focus in the diffs, the list's rows show keyboard focus as their own
outline, and the row a click opened the dialog from gets the focus back
on closing without the keyboard's ring (data-quiet-focus).
React's StrictMode runs the dialog's effect twice in development, the second
time with the focus already in the dialog: the opener has to be read as the
dialog first renders, so that it gets the focus back without the ring.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner November 5, 2026 21:26
@fctl-review

This comment has been minimized.

From fctl's review of #388. The find bar's flag that sends the page to a
match stayed set when a step or a search landed on the match the bar was
at already, so a later change to the diffs scrolled back to it: each step
is now an ask of its own, gone to once. A second ⌘F with the bar open left
a flag set that selected the field's text at the next keystroke, which the
key after it then replaced: the field is now focused and selected once for
each ⌘F. And the list scrolled the opened file into view before the dialog
showed, which does nothing: it does so a frame later, in the list's middle
as it opens.
@kalaspuff
kalaspuff merged commit 198d14a into main Nov 5, 2026
11 checks passed
@kalaspuff
kalaspuff deleted the fctl/691-after-clicking-on-a-file-in-the-file-lis branch November 5, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant