Skip to content

feat(review): whole-file view (o / O) - #172

Merged
backnotprop merged 2 commits into
mainfrom
feat/review-whole-file
Nov 20, 2026
Merged

backnotprop merged 2 commits into
mainfrom
feat/review-whole-file

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Adds a whole-file view to the code review screen.

  • o opens the file under the cursor as it is now, at the same line. O opens the base version at the matching old line (the line is mapped through the hunks; a replaced line maps to the line it replaced).
  • Line numbers, syntax colors, and a bar in the gutter on changed lines (added lines in the current view, removed lines in the base view).
  • Header: Whole file · new · <path> or Whole file · base (abc1234) · <path>.
  • o, O or Esc go back to the diff at the same place. n/N move between files, ]/[ move between changed runs, and the notes rail stays.
  • Notes: c on a line inside a hunk makes an ordinary diff note. Outside every hunk it makes a new-side note with outsideDiff: true and anchorText, like the browser. Such notes list under "Not in the diff" in the rail, and Enter opens the whole file at their line. They export with the browser's (not in the diff) heading and a **Code:** block (checked byte for byte against the browser's exportReviewFeedback).
  • The resolver no longer marks an outside-the-diff note outdated just because it is outside the hunks: it stays "not in the diff" and follows its text on a unique match.
  • The base view is read-only for notes, and the footer says so.
  • Files over 5 MiB per side (the browser's limit), binary files, added files (no base) and deleted files (no current version) show a message instead.
  • Works in PR reviews, including PRs fetched into the bare cache repository; both sides are read from the PR's commits.

Keys: whole-file = o, whole-base = O, in the diff context only (o keeps opening the editor elsewhere). Both are in the "late" list, so an older config that already uses o or O in the diff keeps its binding. README and the help screen are updated.

How it works: the whole-file view is a second diffs-rs engine given a synthetic patch with one context-only hunk that covers the file. This needed no change to diffs-rs.

Limits from the engine, and what this PR does about them:

  • File heading: diffs-rs labels the synthetic patch "Modified +0 −0". The view writes the file's own status and counts in the diff over that summary after the engine draws (for example "Modified +6 −1", "Added +1 −0", or "Not in the diff" for a file the diff does not have).
  • Empty file: diffs-rs rejects an empty hunk; the view says " is empty." instead.
  • Two line-number columns with the same numbers: left as is. diffs-rs 0.2.0 has only Options::line_numbers: bool (all numbers on or off). The unified gutter always prints both numbers: render.rs draw_row builds number(old) + " " + number(new), and code_width reserves digits * 2 + 1 + 3 columns. Removing the duplicate needs a diffs-rs switch read in both places, for example an Options field (unified_numbers: Both | New | Old) or a per-file setting next to the file badges. A way to set the file heading's summary text from the host would also replace the overwrite above.

Tests: patch line mapping, read_whole limits, export, resolver, keymap, and screen tests in review/tests/whole_flow.rs plus a PR cache-repository test in pull_flow.rs.

Rebased onto main after #168 and #170. x in the whole-file view marks the shown file viewed (#171).

@backnotprop
backnotprop force-pushed the feat/review-whole-file branch from ad3b6ad to 980e2bd Compare November 20, 2026 01:25
o opens the file under the cursor as it is now at the same line; O opens the
base version at the matching old line. Line numbers, syntax colors, and a bar
on the changed lines. o, O or Esc go back to the diff at the same place; n/N
move between files and the notes rail stays.

A note on a line inside a hunk is an ordinary diff note. A note outside every
hunk is a new-side note with outsideDiff and anchorText, as in the browser; it
lists under "Not in the diff", Enter opens it in the whole file, and the
resolver no longer marks it outdated for being outside the hunks. The base
version is read-only for notes. Files over 5 MiB, binary, added and deleted
files show a message instead. x marks the shown file viewed.
…ounts

diffs-rs labels the made-up patch "Modified +0 −0"; the view now writes the
file's status and counts in the diff over it (or "Not in the diff").
@backnotprop
backnotprop force-pushed the feat/review-whole-file branch from 980e2bd to 091c5c6 Compare November 20, 2026 02:53
@backnotprop
backnotprop added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 20, 2026
@backnotprop
backnotprop added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 100c175 Nov 20, 2026
3 checks passed
@backnotprop
backnotprop deleted the feat/review-whole-file branch November 20, 2026 03:41
github-merge-queue Bot pushed a commit that referenced this pull request Nov 23, 2026
…the terminal background (#186)

* feat(review): tick viewed files in the file list

The diff viewer's file list now shows a tick after a viewed file's counts and dims its
row; a folder gets the tick once every file in it is viewed, also when collapsed. It uses
diffs-rs `Engine::set_file_marks`, synced on open, on every toggle, when files arrive and
on reload.

Not mergeable yet: `set_file_marks` is not in a diffs-rs release. The root Cargo.toml
patches diffs-rs to a commit of plannotator/diffs-rs feat/file-badges. Once diffs-rs
0.2.1 is published: delete the [patch.crates-io] section, require
diffs-rs = "0.2.1" in crates/plannotator-tui/Cargo.toml, and run
`cargo update -p diffs-rs`.

* feat(review): draw the code review on the terminal's own background

The diff viewer now leaves empty rows, plain context lines and its file list to the
terminal's background and plain text to its foreground, as the document screen does.
Changed lines and hunk headings keep tints from the light or dark palette that the theme
setting picks. Uses diffs-rs `Engine::set_terminal_background`.

Not mergeable yet: needs plannotator/diffs-rs#13 and a diffs-rs release. The root
Cargo.toml patches diffs-rs to that PR's commit; once 0.2.1 is published, delete the
[patch.crates-io] section, require diffs-rs = "0.2.1", and run `cargo update -p diffs-rs`.
If the whole-file view (#172) lands first, its second engine needs the same call.

* build: diffs-rs 0.2.1 from crates.io; the whole-file view on the terminal background too

The [patch.crates-io] pointer to a diffs-rs commit is gone: 0.2.1 has
Engine::set_file_marks and Engine::set_terminal_background.

The whole-file view (o, O) opens a second engine; it now draws on the
terminal's background as the diff does. Tests cover that, the light
palette, and the file list's ticks through x in the whole-file view,
ctrl+n, the rail hidden and shown, a change on disk, a reload that
drops a changed file's mark, and a PR review's own marks.
@backnotprop backnotprop mentioned this pull request Nov 23, 2026
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