Skip to content

Fix character highlights hidden by the line highlight - #17

Merged
ryutaro-asada merged 1 commit into
mainfrom
fix/char-highlight-under-line-hl
Oct 23, 2026
Merged

ryutaro-asada merged 1 commit into
mainfrom
fix/char-highlight-under-line-hl

Conversation

@ryutaro-asada

Copy link
Copy Markdown
Owner

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) with hl_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:

    text before after
    const (line only) #243347 (DiffChange) #243347
    admin / guest / info (char change) #243347 #443827
    user (char add) #243347 #2d5a2d
    return (unchanged) #16181a (Normal) #16181a

    #443827 is the char_change bg #4a4a0e combined 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.

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.
@ryutaro-asada
ryutaro-asada merged commit cbbefb7 into main Oct 23, 2026
2 checks 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.

1 participant