Skip to content

Preserve changed lines that resemble unified diff headers - #34

Merged
WaylandYang merged 3 commits into
deeplethe:devfrom
Maya-Kid:codex/fix-diff-hunk-lines
Oct 15, 2026
Merged

WaylandYang merged 3 commits into
deeplethe:devfrom
Maya-Kid:codex/fix-diff-hunk-lines

Conversation

@Maya-Kid

@Maya-Kid Maya-Kid commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

DiffView and patchStats discarded every line beginning with +++ or ---, including genuine hunk content. For example, changing --count; to ++count; produces such prefixes in a real Git patch, so changes disappeared and their statistics were undercounted.

What changes

Share a small line-filtering helper between rendering and statistics. Track hunk line counts to distinguish changed content from file headers, reset at Git file boundaries, and keep support for compact tool-output hunks. Document the input boundary: complete unified hunks can distinguish file headers by their counts; multi-file compact or truncated output needs diff --git separators. Keeping changed text takes precedence when shortened output omits that information. The public API and styling are unchanged.

How it was checked

  • Fresh npm ci, npm run docs, npm run typecheck, and npm run build pass on Node 26.3.0.
  • Chrome 155: complete /dev/examples reports 389/389 mounted and 0 failed in both themes, without page errors.
  • Generated real patches with git diff --no-index and compared counts with Git's --numstat: prefix-like code/Markdown lines, --- literal / +++ literal hunk text, empty added/deleted lines, missing final newlines, and multiple files all retain their changed lines and correct counts.
  • Checked abbreviated hunks and the existing compact tool-output example, plus CRLF, omitted and zero counts, header context, and compact/truncated multi-file output retaining diff --git boundaries.
  • Checked StepGroup's aggregate statistics and expanded diff. Visually inspected the rendered content, line colors, and open tool step in both themes.

Before review

  • Every commit is signed off (git commit -s)
  • npm run typecheck and npm run build pass
  • /dev/examples reports 0 failed
  • What the change touches was looked at in both themes, open states included
  • A component of Solid Glass's own has its example in src/examples/ and its page in content/solid/

Maya-Kid and others added 3 commits October 15, 2026 18:46
Signed-off-by: Maya Kid <29959320+Maya-Kid@users.noreply.github.com>
Signed-off-by: Maya Kid <29959320+Maya-Kid@users.noreply.github.com>
@WaylandYang
WaylandYang merged commit f808611 into deeplethe:dev Oct 15, 2026
1 check 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