Skip to content

Commit 283fa1f

Browse files
authored
fix(clients): scroll truncated command output notice with logs (#34011)
1 parent 3051b32 commit 283fa1f

2 files changed

Lines changed: 24 additions & 28 deletions

File tree

‎apps/mobile/src/features/threads/thread-command-output.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ export function ThreadCommandOutput(props: {
5353
}
5454
return (
5555
<View className="pt-1.5">
56-
{data?.output.truncated ? (
57-
<Text className="pb-0.5 text-3xs text-foreground-subtle">Earlier output not shown</Text>
58-
) : null}
5956
<ScrollView
6057
ref={scrollRef}
6158
nestedScrollEnabled
@@ -73,6 +70,9 @@ export function ThreadCommandOutput(props: {
7370
if (followRef.current) scrollRef.current?.scrollToEnd({ animated: false });
7471
}}
7572
>
73+
{data?.output.truncated ? (
74+
<Text className="pb-0.5 text-3xs text-foreground-subtle">Earlier output not shown</Text>
75+
) : null}
7676
<Text selectable className="font-mono text-2xs leading-normal text-foreground-muted">
7777
{spans.map((span, index) =>
7878
span.style === null ? (

‎apps/web/src/components/chat/CommandOutputPanel.tsx‎

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,27 @@ export function CommandOutputPanel(props: {
5454
// Parse after all hooks to preserve the text/theme compiler cache.
5555
const spans = terminalOutputSpans(text, TERMINAL_PALETTES[resolvedTheme]);
5656
return (
57-
<div>
58-
{data?.output.truncated ? (
59-
<div className="text-muted-foreground italic">Earlier output not shown</div>
60-
) : null}
61-
<div
62-
ref={scrollRef}
63-
onScroll={(event) => {
64-
const element = event.currentTarget;
65-
followRef.current =
66-
element.scrollHeight - element.scrollTop - element.clientHeight <= FOLLOW_SLACK_PX;
67-
}}
68-
className="max-h-80 overflow-auto text-muted-foreground"
69-
>
70-
{spans.map((span, index) =>
71-
span.style === null ? (
72-
span.text
73-
) : (
74-
// Spans never reorder and are rebuilt on each update.
75-
// oxlint-disable-next-line react/no-array-index-key
76-
<span key={index} style={span.style}>
77-
{span.text}
78-
</span>
79-
),
80-
)}
81-
</div>
57+
<div
58+
ref={scrollRef}
59+
onScroll={(event) => {
60+
const element = event.currentTarget;
61+
followRef.current =
62+
element.scrollHeight - element.scrollTop - element.clientHeight <= FOLLOW_SLACK_PX;
63+
}}
64+
className="max-h-80 overflow-auto text-muted-foreground"
65+
>
66+
{data?.output.truncated ? <div className="italic">Earlier output not shown</div> : null}
67+
{spans.map((span, index) =>
68+
span.style === null ? (
69+
span.text
70+
) : (
71+
// Spans never reorder and are rebuilt on each update.
72+
// oxlint-disable-next-line react/no-array-index-key
73+
<span key={index} style={span.style}>
74+
{span.text}
75+
</span>
76+
),
77+
)}
8278
</div>
8379
);
8480
}

0 commit comments

Comments
 (0)