Skip to content

Fix diff renderer dropping repeated style after :reset op#38

Open
reisub wants to merge 1 commit into
pcharbon70:developfrom
reisub:fix-style-dedup
Open

Fix diff renderer dropping repeated style after :reset op#38
reisub wants to merge 1 commit into
pcharbon70:developfrom
reisub:fix-style-dedup

Conversation

@reisub

@reisub reisub commented May 24, 2026

Copy link
Copy Markdown

filter_redundant_style tracks last_style so it can dedupe :style ops that match the previous one. But it ignored :reset ops, which write \e[0m to the terminal and clear all SGR state. When two adjacent row spans share a style, the sequence was:

  1. row N: :reset, :move, :style(X), :text(...) -- updates last_style to X
  2. row N+1: :reset, :move, :style(X), :text(...) -- :reset wipes terminal SGR state -- :style(X) matches last_style and is deduped away

So row N+1 emitted only text, leaving its cells rendered without any styling. Symptom: multi-row styled spans (e.g. a coloured-band "user message" panel, or a styled status bar that shares a style with a preceding indicator) render styled on the first row and bare on every row after.

Fix: add a clause to filter_redundant_style for :reset that clears the tracked last_style, forcing the next :style op to be emitted in full. Regression test included.

filter_redundant_style tracks last_style so it can dedupe :style ops
that match the previous one. But it ignored :reset ops, which write
\e[0m to the terminal and clear all SGR state. When two adjacent row
spans share a style, the sequence was:

  1. row N: :reset, :move, :style(X), :text(...)
     -- updates last_style to X
  2. row N+1: :reset, :move, :style(X), :text(...)
     -- :reset wipes terminal SGR state
     -- :style(X) matches last_style and is deduped away

So row N+1 emitted only text, leaving its cells rendered without
any styling. Symptom: multi-row styled spans (e.g. a coloured-band
"user message" panel, or a styled status bar that shares a style
with a preceding indicator) render styled on the first row and bare
on every row after.

Fix: add a clause to filter_redundant_style for :reset that clears
the tracked last_style, forcing the next :style op to be emitted
in full. Regression test included.
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