Repository navigation
Fix character highlights hidden by the line highlight - #17
Merged
Merged
Conversation
Since v0.4.1 line highlights used line_hl_group. Its background takes precedence over the character-level highlights drawn on the same line, so changed characters were not visibly highlighted at all. Draw line highlights as a range extmark over the row with hl_eol instead. That keeps the full-width line color (including empty lines) while character highlights at a higher priority show on top. Adds screen tests that read the drawn cell colors; the extmark-only tests from #15 could not catch this.
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.
Problem
Since v0.4.1 (#15), changed characters were not visibly highlighted. Only the line color showed. Reported on
test/01_char_level.js.Line highlights used
line_hl_group. Its background takes precedence over the character-level highlights drawn on the same line, even at higher priority, so the char extmarks existed but were invisible. The #15 tests only checked extmarks, not what is drawn.Fix
Draw line highlights as a range extmark covering the row (
end_row = row + 1, end_col = 0) withhl_eol = true. This keeps the full-width line color (including empty added/deleted lines), and character highlights at priority 200 show on top.Testing
Real terminal render (tmux capture with true colors, the reporter's full config: cyberdream + treesitter) of
test/01_char_level.js:const(line only)#243347(DiffChange)#243347admin/guest/info(char change)#243347#443827user(char add)#243347#2d5a2dreturn(unchanged)#16181a(Normal)#16181a#443827is the char_change bg#4a4a0ecombined with the line bg.New screen tests read drawn cell colors: char highlight on top of the line highlight, and line highlight on empty and past-the-end cells. The first fails on the previous implementation.
make test: 57/57 locally (Neovim 0.12.6). CI: see checks.