Repository navigation
feat(marks): add highlight_from to show the color of the covered mark - #135
Merged
Merged
Conversation
A scrollbar mark type with `highlight_from = "covered"` now shows in the
highlight of the mark that it covers in its cell. With
`marks.Cursor = { highlight_from = "covered" }`, the cursor dot on a row
with an Error shows in the Error color. The default `"self"` keeps the
current behavior. The renderer overrides, presets, and profiles accept
the key. The minimap ignores it, and `minimap.marks` rejects it.
A mark covers the marks that the cell would show without it: the marks
of its lane that lose the collision, and the marks of lower mark layers
in the same cells. The cell takes the first covered mark in that order.
A covered mark that also inherits does not count. Without a covered
mark, the mark keeps its own highlight. Only the color changes. The hit
data, the hover, the peek float, and the jump labels still use the type
of the mark.
The cell uses the groups of the covered type, so the thumb, tint,
pressed, and inactive variants work without new groups. The layer stage
records the covered type of a lane collision on the placed glyph, and
the row reuse of the compose compares it. The field is in the layout
cache key. Without the option, a render does only a few extra field
checks.
The new case `render/line/cursor_mark_covered` takes 42 us, against
38 us for `cursor_mark_search`. `make bench-compare REF=main` reports 0
regressions.
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.
Adds
highlight_fromto the mark types, so that a scrollbar mark can show in the color of the mark that it covers. The main use is the cursor: with the option, the cursor dot on a row with an Error shows in the Error color. The default"self"keeps the current behavior.Changes
highlight_from: each mark type accepts"self"(the default) or"covered". The top-levelmarks,scrollbar.marks, presets, and profiles accept the key. A renderer override or a profile turns off a shared"covered"with"self".highlight_from = "covered"does not count. When no covered mark counts, the mark keeps its own highlight.Scrollbar<Type>,Scrollbar<Type>Thumb,Scrollbar<Type>ThumbPressed,Scrollbar<Type>Tint, and their inactive groups. The option adds no groups. Theinactive_highlightof the covering mark applies only when it covers no mark.Cursor. The minimap ignores the option, andminimap.marksrejects it.docs/configuration.md(Marks),docs/highlights.md(new Covered Marks section), anddocs/minimap/README.md.Review Notes
place_marksandplace_rowrecord the first dropped non-inheriting type on the inheriting glyph that drops it (covered_type). A dropped glyph counts only when that one glyph takes all of its taken cells. The two functions have the same body, so both have the change.row_equivalentnow comparescovered_type. Without that comparison, the compose reused a stale row after the covered mark moved away. The compose test and both renderer tests fail without it.collect_row_marksresolves an inheriting winner without acovered_typefrom the lower layers. The result stays in a table of the row, not on the placed marks, because the compose reuses the placed marks of a row.layout_configcopieshighlight_from, so two profiles that differ only in the option do not share a mark layer.make bench-compare REF=mainreports 0 regressions.render/line/cursor_markis 40.4 µs on main and 43.8 µs on the branch, which the tool rates as noise. The new caserender/line/cursor_mark_covered(the cursor over a mark on most rows) takes 42.2 µs.cursor_mark_coverederrors, because main rejects the new key. The next case,thumb_text_scroll, then also errors on the base side, because the failed setup skips its teardown. Both cases run on the branch."self"asnil, so the default specs and cache keys do not change.overlap.marks = "tint", a covering cell takes the tint of the covered mark, so it looks the same as that mark. This is intentional and documented.Tests
make cipasses: format, lint, typecheck, and the full suite on Neovim 0.12.6 (1230 cases).tests/test_compositor.lua: lane collisions, priority among covered marks, no covered mark, chains, lower layers and lane-first order, a lower mark that the thumb hides, thumb and tint groups, a wide glyph, the covered type in full and incremental layers, and the row reuse case.tests/test_renderer.lua: the cursor moves onto and off an Error row through the in-place path, and a diagnostic appears on the cursor row. A randomized test compares incremental renders with full renders over 200 steps.tests/test_inactive.lua: an inactive window uses the inactive group of the covered type, not the inactive group of the cursor.tests/config/test_init.luaandtests/config/test_profiles.lua: validation, the renderer override, the minimap rejection, the profile, and the layout cache key.