Highlight the matched cells, with per-row extents across a soft wrap #4
Labels
No labels
bug
design
docs
enhancement
good-first-issue
packaging
rendering
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
natsukium/spoor#4
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Draw the match itself, not only its label: highlight the matched cells, and give a soft-wrapped
match a per-row extent so the highlight follows it across the wrap. Implement the
--contrastflag from the design draft while here.
Why
src/picker.rsdrawprints the whole row dim and then prints the label at(m.row, m.col).Nothing marks where the match ends, so with dense text it is not obvious what a label will
actually hand over — the label sits on top of the first cells of the value, hiding them.
docs/design.md"Extension surface" lists--contrast(bracketed labels) among the draft flags;--reverseand--multifrom the same row are implemented,--contrastis not.The wrapped case
matcher::Matchdocuments this gap already:end_colis "the column past the final glyph onwhatever row that glyph sits", which for a wrapped match is not the anchor row, and the doc
comment says a consumer that highlights a wrapped match wants per-row extents anyway.
So highlighting needs the matcher to hand over the extents per physical row, not one
end_col.docs/research.md"Soft-wrapped matches" already prescribes the rendering rule: the highlight issplit per row and the label is drawn onto the leading cells following the wrap. The edge cases it
names: a wide leading glyph, a match shorter than its label, a label at the right edge.
Sketch
Matchcarries the per-row extents (or the spans it was built from) instead of a singleend_col.drawpaints the matched cells with their own attributes before overlaying the label.--contrastbrackets the label so it reads against a busy background.arbitrary cell colours (reverse video rather than a fixed background, most likely).