diff --git a/packages/tui/CHANGELOG.md b/packages/tui/CHANGELOG.md index 91eeef80f..07d564081 100644 --- a/packages/tui/CHANGELOG.md +++ b/packages/tui/CHANGELOG.md @@ -6,6 +6,7 @@ - Fixed native Windows terminal panes freezing their host during forced closure by skipping the impossible stdout-drain wait after ConPTY disconnects ([#6917](https://github.com/can1357/oh-my-pi/issues/6917)). - Fixed the `Loader` spinner pegging a CPU core during idle waits: advancing the braille glyph baked it into the underlying `Text` via `setText`, invalidating the wrap cache every 80 ms tick so `wrapTextWithAnsi` and per-line width measurement re-ran over the whole message. The wrapped text now carries a stable representative for each frame display width and only the visible glyph is swapped at render time, so same-width frames reuse the wrap/width pipeline while custom themes with mixed-width frames remain correctly wrapped ([#6940](https://github.com/can1357/oh-my-pi/issues/6940)). +- Fixed hash-prefixed UUIDs in prose being misclassified as 8-digit CSS colors and receiving spurious swatches ([#7002](https://github.com/can1357/oh-my-pi/issues/7002)). ## [17.1.8] - 2026-07-28 diff --git a/packages/tui/src/components/markdown.ts b/packages/tui/src/components/markdown.ts index cd11dc778..74762014f 100644 --- a/packages/tui/src/components/markdown.ts +++ b/packages/tui/src/components/markdown.ts @@ -1284,11 +1284,12 @@ function collapseInlineHtml(tokens: Token[]): Token[] { const DEFAULT_COLOR_SWATCH_GLYPH = "■"; // `#` + 3-8 hex digits, not glued to a surrounding word/`#`/`&` (avoids HTML -// entities like ☃ and paths like foo#fff) and not trailed by more hex -// (so over-long runs never produce a misleading swatch). Length/letter rules -// are enforced in classifyHexColor since the alternation can't express "exactly -// 3, 6, or 8". -const HEX_COLOR_REGEX = /(? { expect(code.includes("■")).toBe(false); }); + it("does not swatch hash-prefixed UUIDs in prose", () => { + const uuid = new Markdown( + "Use feedback ID #6635765d-4a44-4a5e-a536-a8b72b0395b5 for testing.", + 0, + 0, + defaultMarkdownTheme, + ) + .render(80) + .join(""); + expect(uuid.includes("■")).toBe(false); + + const color = new Markdown("Use color #6635765d.", 0, 0, defaultMarkdownTheme).render(80).join(""); + expect(color.includes(swatchFor("6635765d"))).toBeTruthy(); + }); + it("uses the theme's colorSwatch symbol when provided", () => { const themed = { ...defaultMarkdownTheme, symbols: { ...defaultMarkdownTheme.symbols, colorSwatch: "▢" } }; const out = new Markdown("Accent #C5FFD6.", 0, 0, themed).render(80).join("\n");