💡 Targeted SGR channel resets instead of a blanket reset
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- c, typescript
- Domain
- cli, performance
Research direction
Start with src/clayterm.c:90 in emit_attr, especially the blanket reset at :95 and foreground/background emission at :114/:125. Run test/targeted-sgr-resets.test.ts or inspect the linked repro to establish the current output. Done means changed channels use targeted default resets, unchanged channels remain intact, and the test passes.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem?
On every attribute change, the renderer tears down all SGR state with a blanket \x1b[0m before re-emitting, instead of resetting only the channel that changed (fg vs bg). A red-background cell followed by a default cell generates ...\x1b[48;2;255;0;0mA\x1b[0m... rather than a clean \x1b[49m, resulting in more bytes to process and unnecessary broken foreground sections.
Describe the solution you'd like
Diff the previous and current cell per channel and emit targeted resets when that channel actually changes: \x1b[39m to return the foreground to default, \x1b[49m for the background. Unchanged channels should remain intact across the run. The visible result is identical; the output is smaller and color runs stay continuous.
Describe alternatives you've considered
Keeping the blanket reset and trimming elsewhere doesn't help—the reset is exactly what forces the re-emit. The per-channel diff has to live in emit_attr, alongside the lastfg/lastbg state it already tracks.
Additional context
Failing test case on nm/repro/targeted-sgr-resets (test · diff).
The change likely lives in emit_attr (src/clayterm.c:90)—the blanket reset at :95, foreground/background emit at :114/:125.
- Dominant language
- TypeScript
- Stars
- 42
- Forks
- 2
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bombshell-dev/tty
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bombshell-dev/tty#129 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bombshell-dev/tty#83 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
bombshell-dev/tty#82 ·
-
bug
bombshell-dev/tty#81 · 1 assignee ·
All issues in bombshell-dev/tty
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·