Repository navigation
fix: keep 8-bit color codes, strip them, and drop other 8-bit sequences whole - #704
Merged
Merged
Conversation
The ANSI parser reads the 8-bit CSI (0x9b) as an escape sequence, but stripSgrCodes only matched color codes written with ESC [. Text colored with \x9b31m kept its colors where they should go: a global foreground override left a preserveColors widget's own colors in place, and a Custom Command cut by its max width never got its closing reset, so its color ran into the separators and widgets after it. Match both introducers. restoreBackgroundAfterResets shares the pattern, so an 8-bit reset now gets the background re-applied after it too; its parameter parsing skips a one-character introducer for those.
…whole The terminal sanitizer dropped 8-bit C1 controls one character at a time. For a sequence started by one, that removed only the introducer and left the rest as text: a command printing \x9b31mred\x9b39m showed "31mred39m", and an 8-bit hyperlink or title string showed its URL or payload. Read each 8-bit introducer as the ESC sequence it stands for: CSI (0x9b) as ESC [, OSC (0x9d) as ESC ], and DCS, SOS, PM and APC likewise, with ST (0x9c) ending strings. Color codes and safe hyperlinks are kept, in their 7-bit form, which every terminal reads and the rest of the renderer parses; any other sequence is dropped whole. Lone 8-bit controls that start no sequence, such as NEL or a stray ST, are still dropped.
axisrow
added a commit
to axisrow/ccstatusline
that referenced
this pull request
Oct 15, 2026
…rs (#64) * chore(deps-dev): bump vitest from 4.1.11 to 5.0.0 (sirmalloc#723) Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 4.1.11 to 5.0.0. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v5.0.0/packages/vitest) --- updated-dependencies: - dependency-name: vitest dependency-version: 5.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump react-devtools-core from 7.0.1 to 8.0.0 (sirmalloc#722) Bumps [react-devtools-core](https://github.com/react/react/tree/HEAD/packages/react-devtools-core) from 7.0.1 to 8.0.0. - [Release notes](https://github.com/react/react/releases) - [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/react/react/commits/react-devtools@8.0.0/packages/react-devtools-core) --- updated-dependencies: - dependency-name: react-devtools-core dependency-version: 8.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump actions/setup-node from 7.0.0 to 7.1.0 (sirmalloc#720) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 7.0.0 to 7.1.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@8207627...949feb2) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 7.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump the dev-dependencies group across 1 directory with 6 updates (sirmalloc#733) Bumps the dev-dependencies group with 6 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@remotion/cli](https://github.com/remotion-dev/remotion) | `4.0.532` | `4.0.534` | | [eslint](https://github.com/eslint/eslint) | `10.11.0` | `10.12.0` | | [globals](https://github.com/sindresorhus/globals) | `17.12.0` | `17.13.0` | | [remotion](https://github.com/remotion-dev/remotion) | `4.0.532` | `4.0.534` | | [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.70.1` | `8.71.1` | | [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `5.0.0` | `5.0.3` | Updates `@remotion/cli` from 4.0.532 to 4.0.534 - [Release notes](https://github.com/remotion-dev/remotion/releases) - [Commits](remotion-dev/remotion@v4.0.532...v4.0.534) Updates `eslint` from 10.11.0 to 10.12.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](eslint/eslint@v10.11.0...v10.12.0) Updates `globals` from 17.12.0 to 17.13.0 - [Release notes](https://github.com/sindresorhus/globals/releases) - [Commits](sindresorhus/globals@v17.12.0...v17.13.0) Updates `remotion` from 4.0.532 to 4.0.534 - [Release notes](https://github.com/remotion-dev/remotion/releases) - [Commits](remotion-dev/remotion@v4.0.532...v4.0.534) Updates `typescript-eslint` from 8.70.1 to 8.71.1 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.71.1/packages/typescript-eslint) Updates `vitest` from 5.0.0 to 5.0.3 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v5.0.3/packages/vitest) --- updated-dependencies: - dependency-name: "@remotion/cli" dependency-version: 4.0.534 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies - dependency-name: eslint dependency-version: 10.12.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: globals dependency-version: 17.13.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: remotion dependency-version: 4.0.534 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies - dependency-name: typescript-eslint dependency-version: 8.71.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: vitest dependency-version: 5.0.3 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat(usage): add Spend Limit Usage and Spend Limit Amount widgets (sirmalloc#695) Claude Code 2.1.251 added rate_limits.spend_limit to the status line payload for developers behind a Claude apps gateway. Parse it and show it with two widgets that read the payload only and never call the usage API. Closes sirmalloc#572 Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com> * fix: draw the text cursor as a bar so trailing spaces show (sirmalloc#710) * fix: draw the text cursor as a bar so trailing spaces show The label editor quotes the label so a trailing space stays visible, but the cursor was a highlighted block: over a character, or a highlighted space after the text when at the end. So a label ending in a space with the cursor on it ("Weekly:" + block) looked the same as a label with no space and the cursor past the end ("7d" + block), and "7d" read as "7d ". Draw the cursor as a bar between characters instead. It never covers a character, so a trailing space shows as a gap before it, and the end of the text adds nothing that looks like a space. Custom Text shares the cursor, so it gets the bar too. * feat(tui): preview label edits live and blink editor cursors --------- Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com> * fix(usage): call Session Usage Block Usage, ending its "Session:" label clash (sirmalloc#708) * fix(usage): call Session Usage Block Usage, ending its "Session:" label clash Three widgets printed the label "Session: " and meant two different things by it. Session Clock and Session Name mean the Claude Code conversation; Session Usage meant the 5-hour usage window. On one line, "Session: 42% | Session: 1hr 5m" reads as two facts about the same session when they aren't. The 5-hour window already has a name here: Block Timer and Block Reset Timer call it the block. Session Usage becomes Block Usage, labeled "Block: ", with the description "Shows the current 5-hour block's usage percentage". Its type stays session-usage, so saved configs keep working, and anyone who prefers the old label can set "Session: " back with the label editor (e). The docs follow; past release notes keep the name they shipped with. * fix(usage): label Block Usage "5h: " rather than "Block: " "Block: " is already Block Timer's label, for the block's elapsed time ("Block: 3hr 45m"), so Block Usage beside it would print two "Block:" figures. Label it "5h: " instead, which says which window the percent is of and pairs with Weekly Usage's "Weekly: ". The name stays Block Usage, and a "Session: " override still sets the old label back. --------- Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com> * fix: keep 8-bit color codes, strip them, and drop other 8-bit sequences whole (sirmalloc#704) * fix(ansi): strip 8-bit color codes as well as ESC [ ones The ANSI parser reads the 8-bit CSI (0x9b) as an escape sequence, but stripSgrCodes only matched color codes written with ESC [. Text colored with \x9b31m kept its colors where they should go: a global foreground override left a preserveColors widget's own colors in place, and a Custom Command cut by its max width never got its closing reset, so its color ran into the separators and widgets after it. Match both introducers. restoreBackgroundAfterResets shares the pattern, so an 8-bit reset now gets the background re-applied after it too; its parameter parsing skips a one-character introducer for those. * fix(sanitize): keep 8-bit color codes and drop other 8-bit sequences whole The terminal sanitizer dropped 8-bit C1 controls one character at a time. For a sequence started by one, that removed only the introducer and left the rest as text: a command printing \x9b31mred\x9b39m showed "31mred39m", and an 8-bit hyperlink or title string showed its URL or payload. Read each 8-bit introducer as the ESC sequence it stands for: CSI (0x9b) as ESC [, OSC (0x9d) as ESC ], and DCS, SOS, PM and APC likewise, with ST (0x9c) ending strings. Color codes and safe hyperlinks are kept, in their 7-bit form, which every terminal reads and the rest of the renderer parses; any other sequence is dropped whole. Lone 8-bit controls that start no sequence, such as NEL or a stray ST, are still dropped. * feat(claude-status): optionally link the widget to the status page (sirmalloc#701) * feat(claude-status): optionally link the widget to the status page Claude Status shows "minor" or "major" when something's wrong, but the details are on status.claude.com, which you have to look up. Git Branch and Git Root Dir can already link to the repo or IDE. Press `l` on Claude Status to make the whole widget an OSC 8 hyperlink to https://status.claude.com, the site it reads the status from: label, status and the history strip, and an unknown "?" too, when the page is most worth a look. It's off by default, like the other links, and the editor row shows "status link". Terminals without OSC 8 support show the text as before. * fix(preview): preserve enabled widget hyperlinks --------- Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com> * fix(powerline): detect Nerd Fonts v3 names and fonts in font subfolders checkPowerlineFonts() scanned only the top level of the font folders and required a spaced "nerd font" pattern, so common layouts were reported as missing: Nerd Fonts v3 file names have no spaces ("JetBrainsMonoNerdFont-Regular.ttf"), the short "NF" form exists ("JetBrainsMonoNF-Regular.ttf"), and font managers nest fonts in subfolders ("NerdFonts/", "TTF/", Debian's /usr/share/fonts/opentype/PowerlineSymbols.otf). Match "nerd ?font" and an "NF" token, and scan the font folders recursively with a depth cap. Co-Authored-By: Claude Code <noreply@anthropic.com> * chore: retrigger CI after merge * chore: probe CI trigger * chore: probe CI trigger after actions re-enable * chore: probe CI trigger after fork workflows re-enable * fix: align tests and compact labels with merged upstream changes Three merge fallouts after merging origin/main into the PR branch: - upstream-terminal-sanitize: upstream c08a59d drops an 8-bit C1 CSI sequence whole (terminals consume it as one unit), so \x9b2J no longer leaves 2J as text; expect 'okx'. - usage-prefetch: the fork's async providers pass a cache handle in every fetchUsageData call; the upstream spend-limit test now uses the same anyCacheMatcher() as the neighboring assertions. - compact labels: upstream 6e148cb renamed the session usage label from "Session:" to "5h:", so the compact-label probe dropped the widget; add the '5h: ' preset. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mert Kaya <47145541+mertkayacs@users.noreply.github.com> Co-authored-by: Matthew Breedlove <sirmalloc@gmail.com> Co-authored-by: eric-engberg <60901620+eric-engberg@users.noreply.github.com> Co-authored-by: axisrow <axisrow@users.noreply.github.com> Co-authored-by: Claude Code <noreply@anthropic.com>
axisrow
added a commit
to axisrow/ccstatusline
that referenced
this pull request
Oct 20, 2026
…sirmalloc#704/sirmalloc#708/sirmalloc#710, dep bumps) Upstream cursor-bar fix (sirmalloc#710) ported into fork lazy editors in src/widgets/editors/. Fork compaction-counter no-space glyph and usage-prefetch cache matcher kept. Co-Authored-By: Claude Code <noreply@anthropic.com>
pcvelz
added a commit
to pcvelz/ccstatusline-usage
that referenced
this pull request
Oct 21, 2026
Upstream: - Spend Limit Usage and Spend Limit Amount widgets (sirmalloc#695) - Session Usage renamed to Block Usage, ending its Session label clash (sirmalloc#708) - keep 8-bit color codes, strip them, drop other 8-bit sequences whole (sirmalloc#704) - text cursor drawn as a bar so trailing spaces show (sirmalloc#710) - Claude Status widget optionally links to the status page (sirmalloc#701) - dependency bumps: vitest major (sirmalloc#723), react-devtools-core major (sirmalloc#722), actions/setup-node (sirmalloc#720), dev-dependencies group (sirmalloc#733) Conflict resolutions: - .github/workflows/publish.yml, docs/DEVELOPMENT.md, docs/USAGE.md: kept deleted (.fork-keep-deleted) - src/types/RenderContext.ts, src/utils/usage-types.ts: fork weeklyFableUsage fields kept, upstream spendLimit fields added; upstream fableUsage fields dropped (their FableWeeklyUsage widget is fork-deleted) - src/utils/widget-manifest.ts, src/widgets/index.ts: spend-limit widgets added; upstream fable-weekly-usage dropped (fork-deleted), fork keeps its own reset-timer entry - src/widgets/shared/usage-percent-widget.ts: fork fable-weekly kind kept, upstream spend-limit kind added - src/utils/usage-prefetch.ts: fork per-item requirements and API-sourced weekly kept, upstream spend-limit extraction added - src/utils/__tests__/usage-prefetch.test.ts: upstream test for weekly usage from rate_limits stays retired (docs/test-retirements.md, a56a58e); upstream spend-limit tests added Hand edits outside conflicts: - src/utils/__tests__/usage-prefetch.test.ts: compat fix - upstream spend-limit tests reference mockFetchUsageData, the fork's mock is mockFetchUsage - docs/test-retirements.md: ledger entries for two tests upstream replaced (sirmalloc#704 8-bit sequences, sirmalloc#701 OSC links in the preview)
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.
Fixes #690, and the visible junk the terminal sanitizer (from the escape-injection fix) leaves where it drops an 8-bit sequence's introducer.
What
Color codes written with the 8-bit CSI (
U+009B) in place ofESC [now work like the 7-bit ones:ESC [ … m. Before, it dropped only theU+009Band printed the rest: a command printing\x9b31mred\x9b39mshowed31mred39m.\x9b2J), and OSC, DCS, SOS, PM and APC strings, used to leave their parameters or payload as text. An 8-bit hyperlink with a safe URL is kept, also in its 7-bit form.stripSgrCodesremoves them (stripSgrCodes leaves C1 SGR styling already supported by the ANSI parser #690). A global foreground override now strips a preserveColors widget's 8-bit colors, and a Custom Command cut by its max width gets its closing reset, so its color no longer runs into what follows.Why
The ANSI parser has read 8-bit CSI and OSC since #660, so widths already treated these codes as invisible. Two places didn't:
stripSgrCodesmatched onlyESC [, which is stripSgrCodes leaves C1 SGR styling already supported by the ANSI parser #690's report.38;5;161mfeature/login0mwhere the command printed a pinkfeature/login. This is worse than stripSgrCodes leaves C1 SGR styling already supported by the ANSI parser #690 describes, because it affects every widget's output, not just the override and truncation paths.How
terminal-sanitize.ts:ESC [, OSC asESC ], DCS/SOS/PM/APC asESC P/X/^/_, with ST (0x9c) ending strings.ESC.ansi.ts:SGR_REGEXmatchesESC [or0x9b.restoreBackgroundAfterResetsshares the pattern, so its parameter parsing skips the one-character introducer for the 8-bit form.Demo
A Custom Command with preserve colors running
printf '\302\23338;5;161mfeature/login\302\2330m'(\302\233isU+009Bin UTF-8). Line 1 prints it whole; line 2 cuts it to 12 columns.Powerline
main)Plain
main)Testing
terminal-sanitize.test.ts:CSI b, OSC 52, an OSC 0 title, a hyperlink with an unsafe URL, DCS, APC, PM and SOS.ansi.test.ts:stripSgrCodesremoves 8-bit and mixed color codes and leaves other CSI sequences and hyperlinks alone;restoreBackgroundAfterResetshandles an 8-bit reset.CustomCommand.test.ts: a truncated 8-bit-colored output ends with a reset.renderer-sanitize.test.ts: a widget's 8-bit colors reach the pre-rendered line asESC [, with the right width.bun test: 3125 pass, 0 fail.bun run lintpasses.CustomCommand.test.ts's cache tests, which spy onos.homedirand fail the same way onmainunder Node.runtime-check.sh, Bun 1.4.2 and Node 26.10.0):main.mainas shown above.