Skip to content

diff: color the unchanged lines of a context format hunk - #378

Merged
sylvestre merged 1 commit into
uutils:mainfrom
binhvq:color-context-format-lines
Nov 11, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
binhvq:color-context-format-lines

Conversation

@binhvq

@binhvq binhvq commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #353.

With --color -c, GNU colors the unchanged lines too: as deleted in the old-file part of a hunk, as added in the new-file part. Only the -, + and ! lines were colored here.

\ No newline at end of file and the *************** line stay uncolored, as in GNU 3.12. Updated the context unit test and added one for context lines that look like markers.

With --color, GNU diff gives every line of the old-file part of a -c hunk the color of deleted text and every line of the new-file part the color of added text. Only the changed lines were colored here.
@sylvestre
sylvestre merged commit 42b17fc into uutils:main Nov 11, 2026
31 checks passed
@sylvestre

Copy link
Copy Markdown
Collaborator

Thanks for your PR

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.

diff - --color -c leaves the context lines of each hunk half uncolored

2 participants