Fix diff renderer dropping repeated style after :reset op#38
Open
reisub wants to merge 1 commit into
Open
Conversation
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.
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.
filter_redundant_styletrackslast_styleso it can dedupe:styleops that match the previous one. But it ignored:resetops, which write\e[0mto the terminal and clear all SGR state. When two adjacent row spans share a style, the sequence was::reset,:move,:style(X),:text(...)-- updateslast_styleto X:reset,:move,:style(X),:text(...)--:resetwipes terminal SGR state --:style(X)matches last_style and is deduped awaySo 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_stylefor:resetthat clears the trackedlast_style, forcing the next:styleop to be emitted in full. Regression test included.