fix(tui): reset SGR state after row clears#87
Open
code-yeongyu wants to merge 1 commit into
Open
Conversation
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.
Summary
Fixes TUI rendering corruption where raw ANSI SGR fragments such as
9;131;232mcould appear after differential row clears. The local fork has row-clear/repaint optimization paths that are not present upstream; those paths now reset terminal style state immediately afterCSI 2Kbefore writing colored content.Before: changed-row repaint could clear a row and continue in the terminal's previous style state, allowing truecolor SGR tails or colored artifacts to leak into the display.
After: every repaint/replay row clear emits the existing
TUI.SEGMENT_RESETbefore row content, preserving the low-flicker path while avoiding stale style state.Changes
QA / Evidence
packages/tuicommandnode --test --import tsx test/tui-render-sgr-reset.test.ts; captured the missing reset failure inlocal-ignore/qa-evidence/20260626-tui-render-sgr/tui-render-red.txt.local-ignore/qa-evidence/20260626-tui-render-sgr/tui-render-green.txt.node --test --import tsx test/tui-render.test.tspassed 36/36; artifactlocal-ignore/qa-evidence/20260626-tui-render-sgr/tui-render-suite-green.txt.npm run checkpassed; artifactlocal-ignore/qa-evidence/20260626-tui-render-sgr/npm-check.txt.node .agents/skills/senpi-qa/scripts/tui-smoke.mjs --self-test --driver tmux --evidence tui-render-sgrpassed 5/5, confirmed auth unchanged and no raw SGR fragments in the captured TUI transcript; artifactslocal-ignore/qa-evidence/20260626-tui-render-sgr/senpi-tui-smoke.txtandlocal-ignore/qa-evidence/20260626-tui-render-sgr/tui-smoke-tmux.txt.npm run checksuccessfully before commit.Risks
The main risk is extra reset bytes in repaint paths affecting terminal styling or Kitty image cleanup. This is covered by the focused SGR repaint regression, the existing TUI render suite including Kitty cleanup, and the tmux smoke test against the real TUI harness.
Secret safety
No raw secret-bearing logs, env dumps, tokens, auth headers, cookies, or credentials are included. The senpi QA script verified the real auth file was unchanged.
Summary by cubic
Reset terminal style after each row clear in the TUI to prevent leaked ANSI SGR state and color artifacts. Keeps low-flicker repaints while ensuring cleared rows start from a neutral style.
CSI 2Kacross repaint paths: viewport/scrollback replay, inserted/deleted/extra line clears, and Kitty image reserved-row clears.Written for commit 58339e2. Summary will update on new commits.