• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

umputun / revdiff / 24744742665

21 Apr 2026 08:27PM UTC coverage: 89.188% (+0.04%) from 89.152%
24744742665

push

github

web-flow
feat: add compact diff mode with --compact flag and C keybinding (#135)

* add plan: compact-diff-mode

* feat: add contextLines parameter to Renderer.FileDiff

Extends both diff.Renderer and ui.Renderer interfaces with a contextLines
int parameter on FileDiff. All wrappers (Fallback, Exclude, Include) pass
it through to the inner renderer; context-only sources (FileReader,
DirectoryReader, StdinReader) ignore it. VCS renderers accept it but
continue to use the hardcoded full-file context arg — arg construction
moves to Task 2. UI callsites pass 0 for now, preserving behavior.

Both moq mocks regenerated.

* feat: use contextLines in Git/Hg/Jj FileDiff via per-renderer helpers

Replace the hardcoded full-file arg in the three VCS renderers with small
helpers (gitContextArg, hgContextArg, jjContextArg) that map the caller's
contextLines value to the right -U / --context= argument. Zero / negative /
>= 1000000 keeps the existing full-file behavior via the fullFileContext
(and jjFullContext) sentinel; any positive value below the sentinel becomes
a small-context request.

Table-driven tests cover the helpers, and end-to-end tests build a real
20-line file in a tiny repo for each VCS, invoke FileDiff with
contextLines=2, and assert exactly 1 added / 1 removed / 4 context lines,
confirming the arg reaches the underlying VCS. A paired contextLines=0
assertion locks in the full-file default.

* feat: add Compact and CompactContext config fields

Adds --compact boolean flag and --compact-context int flag (default 5)
to the options struct. These will drive the new compact diff mode that
passes a smaller -U value to the underlying VCS.

Both flags follow the --collapsed precedent with matching long/ini-name/env
tags. Tests cover CLI flag, env var, and config file parsing variants plus
default values.

* feat: add ActionToggleCompact keymap action with default binding C

* feat: wire compact diff mode into UI model

Add compact/compactContext fields to modeState... (continued)

113 of 118 new or added lines in 14 files covered. (95.76%)

174 existing lines in 10 files now uncovered.

7696 of 8629 relevant lines covered (89.19%)

471.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.64
/app/diff/diff.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc