fix(highlights): preserve character group attributes - #447
Merged
esmuellert merged 3 commits intoJul 25, 2026
Conversation
richardgill
marked this pull request as ready for review
July 17, 2026 08:03
richardgill
marked this pull request as draft
July 17, 2026 10:53
richardgill
marked this pull request as ready for review
July 18, 2026 10:09
…to fix-char-highlight-attributes
esmuellert
approved these changes
Jul 25, 2026
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.
Summary
Preserve the full highlight definition when
char_insertorchar_deletereferences a highlight group, instead of copying only its effective background.Motivation: I wanted to style char insert text white like github diffs. And this was preventing me from doing that.
Example
Given this change:
Before this fix:
Only the background was copied. The configured foreground,
bold, andnocombineattributes were lost.After this fix:
Resulting rendering:
What changed
nocombinefrom configured character highlight groups.reverseflags.ColorSchemechanges.Behavior change
Named character highlight groups now define the complete appearance of changed characters. Users who want a background override without replacing syntax foreground or styles can continue to use a direct color or a custom background-only highlight group. Default and automatically derived character highlights are unchanged.
Test coverage
Added coverage for preserved attributes, reverse colors, line and direct-color behavior, derived highlights, and
ColorSchemeupdates.Fixes #446