preserve background from line when computing span styles

This commit is contained in:
Emil Lerch 2026-06-10 16:24:32 -07:00
parent 7fffca04c3
commit c97551a476
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -1539,9 +1539,23 @@ pub const App = struct {
// wins. Spans are expected to be small (<= ~15 per
// line for the review tab's column count), so a
// linear scan per cell is fine.
//
// Span composition rule: spans describe a per-cell
// semantic intent (positive/negative/muted/etc.)
// they own fg, bold, italic, underline. The row's
// base style owns bg (so a cursor-row's highlight
// bar reads as a continuous span across the whole
// row, not gappy where the colored cells land).
// `alt_*` (used by braille charts) keeps the
// legacy "replace fully" behavior since those
// overlays are decorative chart fills where the
// bg IS the signal.
if (line.spans) |spans| {
for (spans) |sp| {
if (col >= sp.start and col < sp.end) s = sp.style;
if (col >= sp.start and col < sp.end) {
s = sp.style;
s.bg = line.style.bg;
}
}
} else if (line.alt_style) |alt| {
if (col >= line.alt_start and col < line.alt_end) s = alt;