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, 19:45 UTC
fix(web): PR comment hover excerpts no longer end in a replacement character (#35111)
Julius Marminge committed
Nov 12, 2026 at 02:46 UTC
abbd967c4bdc69003687313b10278f392fa8155e
2 files changed
+14
-1
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+8
@@ -364,6 +364,14 @@ describe("pull request timeline", () => {
364
for (const url of [pr, `${pr}/files`, `${pr}/checks`, `${pr}#issuecomment-6`]) {
365
expect(pullRequestLinkSubject(url, activity), url).toBeNull();
366
}
367
+ // An emoji straddling the cut is dropped whole rather than split into a lone surrogate.
368
+ const long = {
369
+ ...activity,
370
+ comments: [{ ...activity.comments[0]!, body: `${"i ".repeat(139)}😀bb` }],
371
+ };
372
+ const cut = pullRequestLinkSubject(`${pr}#issuecomment-5`, long);
373
+ const excerpt = cut && "excerpt" in cut ? cut.excerpt : null;
374
+ expect(excerpt).toMatch(/^(?:i ?)+…$/u);
375
});
376
377
it("orders host timestamps by instant across offsets and fractional seconds", () => {
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
+6
-1
@@ -732,7 +732,12 @@ function markdownExcerpt(body: string): string | null {
732
.replace(/\s+/gu, " ")
733
.trim();
734
if (text === "") return null;
735
- return text.length > LINK_EXCERPT_LENGTH ? `${text.slice(0, LINK_EXCERPT_LENGTH - 1)}…` : text;
735
+ if (text.length <= LINK_EXCERPT_LENGTH) return text;
736
+ let end = LINK_EXCERPT_LENGTH - 1;
737
+ // Never end on a lone high surrogate.
738
+ const last = text.charCodeAt(end - 1);
739
+ if (last >= 0xd800 && last <= 0xdbff) end -= 1;
740
+ return `${text.slice(0, end)}…`;
741
}
742
743
/** The comment or commit a pull request link names, for its hover card; null for the PR itself. */