@devries-cameron20 / t3code Mirror · read-only / commits / 1e87029261
Fork 0

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 24, 16:30 UTC

fix(web): preserve Claude insight line breaks (#4344)

Yukun Shan committed Aug 15, 2026 at 18:43 UTC 1e87029261f9b81061a2a7420849b9eeaf1a2ebe
3 files changed +18
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+12
@@ -5,8 +5,20 @@ import {
5 deriveMessagesTimelineRows,
6 normalizeCompactToolLabel,
7 resolveAssistantMessageCopyState,
8 + shouldPreserveAssistantLineBreaks,
9 } from "./MessagesTimeline.logic";
10
11 +describe("shouldPreserveAssistantLineBreaks", () => {
12 + it("preserves Claude insight formatting without changing regular markdown", () => {
13 + expect(
14 + shouldPreserveAssistantLineBreaks(
15 + "★ Insight ─────────────────\\nFirst observation\\nSecond observation\\n─────────────────",
16 + ),
17 + ).toBe(true);
18 + expect(shouldPreserveAssistantLineBreaks("A normal\\nmarkdown paragraph")).toBe(false);
19 + });
20 +});
21 +
22 describe("computeMessageDurationStart", () => {
23 it("returns message createdAt when there is no preceding user message", () => {
24 const result = computeMessageDurationStart([
apps/web/src/components/chat/MessagesTimeline.logic.ts
+4
@@ -52,6 +52,10 @@ export function resolveTimelineIsAtEnd(
52 return contentLength - scroll - scrollLength - endInset <= TIMELINE_FOLLOW_REARM_THRESHOLD_PX;
53 }
54
55 +export function shouldPreserveAssistantLineBreaks(text: string): boolean {
56 + return /^★ Insight(?:\s|─)/mu.test(text);
57 +}
58 +
59 export function resolveTimelineMinimapHeightStyle(itemCount: number): string {
60 const naturalHeight = Math.max(1, (itemCount - 1) * TIMELINE_MINIMAP_ITEM_SPACING);
61 return `min(${naturalHeight}px, ${TIMELINE_MINIMAP_MAX_HEIGHT_CSS})`;
apps/web/src/components/chat/MessagesTimeline.tsx
+2
@@ -83,6 +83,7 @@ import {
83 resolveTimelineMinimapIndexFromPointer,
84 resolveTimelineMinimapInteractiveWidth,
85 resolveTimelineMinimapTopPercent,
86 + shouldPreserveAssistantLineBreaks,
87 type StableMessagesTimelineRowsState,
88 type MessagesTimelineRow,
89 TIMELINE_MINIMAP_MIN_ITEMS,
@@ -1113,6 +1114,7 @@ function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "mess
1114 cwd={ctx.markdownCwd}
1115 threadRef={ctx.threadRef ?? undefined}
1116 isStreaming={Boolean(row.message.streaming)}
1117 + lineBreaks={shouldPreserveAssistantLineBreaks(messageText)}
1118 skills={ctx.skills}
1119 />
1120 <AssistantChangedFilesSection