fix(diff): preserve spaces in word-diff highlights and render without chroma - #17
Merged
Merged
Conversation
… chroma Word-diff intra-line highlighting was injecting raw spaces into HTML that otherwise contained entities from chroma's whitespace normalization, causing spaces to visually collapse inside highlight spans. Escape word tokens with for spaces and tabs to match chroma's output. The template also gated intra-line diff HTML behind RenderFile, silently discarding word-diff output when syntax highlighting was disabled. Switch the guard to check for HTML presence directly so word-diff renders in both modes while context lines still fall back to plain text. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jfyne
marked this pull request as ready for review
April 13, 2026 09:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whats changed
Adds an
escapeWordTokenhelper ininternal/app/worddiff.gothat converts spaces and tabs to entities when rendering intra-line word-diff highlights, and changes three diff cells ininternal/ui/template.htmlto gate intra-line HTML on the presence of.HTMLinstead of theRenderFileflag.Risk Profile
Overall: CRITICAL — no test coverage drives the floor to High, and the bug-fix type as a second non-low signal escalates to Critical per the algorithm; in practice this is an 18-LOC visual-rendering fix and reviewers should weight the test-coverage and type signals against the small change size.
Suggested Review Order
escapeWordTokenand switchesrenderIntraLineHTMLto use it when escaping word tokens for both old and new side buffers.code-textdivs (split-view left, split-view right, unified view) so intra-line HTML is rendered whenever.HTMLis non-empty rather than only whenRenderFileis true.