The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 21:00 UTC
fix(web): formatted link labels wrap inside table cells (#27781)
Julius Marminge committed
Nov 11, 2026 at 16:13 UTC
cc624432ac9b137f27f1d718a4cefb0a46d6a0c0
2 files changed
+19
-1
apps/web/src/components/ChatMarkdown.browser.test.tsx
+17
@@ -296,6 +296,23 @@ describe("ChatMarkdown favicon privacy", () => {
296
});
297
});
298
299
+describe("ChatMarkdown external link labels", () => {
300
+ it("keeps a leading emoji whole", async () => {
301
+ setup();
302
+ await using screen = await render(
303
+ <ChatMarkdown cwd="/tmp/project" text="[😀 Read the documentation](https://example.com)" />,
304
+ );
305
+ await vi.waitFor(() => {
306
+ const link = screen.container.querySelector("a");
307
+ expect(link?.textContent).toContain("😀 Read");
308
+ const walker = document.createTreeWalker(link!, NodeFilter.SHOW_TEXT);
309
+ const textNodes: string[] = [];
310
+ while (walker.nextNode()) textNodes.push(walker.currentNode.nodeValue ?? "");
311
+ expect(textNodes.filter((node) => /\p{Surrogate}/u.test(node))).toEqual([]);
312
+ });
313
+ });
314
+});
315
+
316
describe("ChatMarkdown streaming", () => {
317
it("runs only a complete single-line shell block after a click", async () => {
318
setup();
apps/web/src/components/chat/MarkdownExternalLink.tsx
+2
-1
@@ -51,7 +51,8 @@ const MarkdownLinkFavicon = memo(function MarkdownLinkFavicon({ host }: { host:
51
function leadingExternalLinkTextLength(text: string): number {
52
const protocol = /^(?:https?:\/\/)/i.exec(text)?.[0];
53
if (protocol) return protocol.length;
54
- return Math.min(text.length, 1);
54
+ // A whole code point, so a surrogate pair is not split across elements.
55
+ return Array.from(text.slice(0, 2))[0]?.length ?? 0;
56
}
57
58
// Keep short labels such as PR numbers intact in narrow table columns.