Skip to content

feat: per-section +/- totals and spacing on panel headers - #26

Open
orandvlp wants to merge 3 commits into
undont:mainfrom
orandvlp:feat/panel-section-diffstat
Open

feat: per-section +/- totals and spacing on panel headers#26
orandvlp wants to merge 3 commits into
undont:mainfrom
orandvlp:feat/panel-section-diffstat

Conversation

@orandvlp

Copy link
Copy Markdown

Adds a per-section diffstat aggregate to the file panel's section headers and a blank-line separator between sections.

Section aggregate. Each section header (Staged/Unstaged/Untracked) now shows its total +A -B, pinned to the same content column as the per-file counts and the --stat help-line total, so a section's weight reads at a glance. Totals are summed fold-independently, matching the existing global --stat sums. Empty/zero-count sections show nothing.

Spacing. Consecutive sections are separated by a blank line so a header doesn't butt up against the previous section's files. The first section is skipped (it already follows the top header's blank), and the top/bottom panel width-fit accounts for a header's aggregate width so a wide +N -M can't clip.

Tests. Added unit coverage (panel_render_spec) for the header aggregate and the section separator; updated the one panel_spec fold test that hard-coded the old layout.

Ran make lint and make lua-typecheck clean locally.

Open questions for the maintainer:

  • Separator as a blank line vs a ─── rule — I went with the blank line (lighter in a narrow panel, no new highlight group). Happy to switch.
  • Should the header aggregate be opt-out via a panel config flag, or always on?

orandvlp added 2 commits July 14, 2026 12:48
Pin each section's aggregate additions/deletions on its header row
(Staged/Unstaged/Untracked), in the same content column as the per-file
counts and the --stat help-line total, so a section's weight reads at a
glance. Totals are summed fold-independently, matching the existing
global --stat sums.

Separate consecutive sections with a blank line so headers don't butt up
against the previous section's files; the first section is skipped since
it already follows the top header's blank.

The horizontal (top/bottom) panel width-fit now accounts for a header's
aggregate width so a wide "+N -M" can't clip off the edge.
@orandvlp

Copy link
Copy Markdown
Author

On the demo recording: CONTRIBUTING asks that visible/panel changes re-record .demo/demo.gif/.demo/demo.mp4. I've held off because the per-section totals only surface when the panel has multiple populated sections, so showing them off well would mean extending demo.tape with a suitable scene rather than just re-recording the existing one — a call I'd rather leave to you. Happy to record it (and/or add a scene) if you'd like it in this PR; otherwise it can follow separately.

…off by default)

The per-section +/- header totals are now opt-in via panel.section_diffstat,
defaulting off. The header block only carries its add/del totals when enabled;
the width reserve and virt_text extmark already guard on the totals, so a nil
suppresses the aggregate and the header renders plain.
@undont

undont commented Jul 24, 2026

Copy link
Copy Markdown
Owner

can we split the settings up by panel.section_diffstat and panel.section_separator so they're settable independently?

also would be nicer i think if separator was a union, so it could potentially expand in the future (other separator styles) rather than locking in now into a on/off

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