From c97551a476fb49ea50364ede73ccd5164eea5c06 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Wed, 10 Jun 2026 16:24:32 -0700 Subject: [PATCH] preserve background from line when computing span styles --- src/tui.zig | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tui.zig b/src/tui.zig index 1ea8339..cc65943 100644 --- a/src/tui.zig +++ b/src/tui.zig @@ -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;