Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/cli/ui/cards/ReasoningCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ interface BodyProps {
function StreamingPreview({ card, allLines, lineCells }: BodyProps): React.ReactElement {
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
const visible = visualLines.slice(-STREAMING_PREVIEW_LINES);
return <BodyLines card={card} lines={visible} lineCells={lineCells} cursorOnLast />;
const padCount = Math.max(0, STREAMING_PREVIEW_LINES - visible.length);
return (
<>
<BodyLines card={card} lines={visible} lineCells={lineCells} cursorOnLast />
{Array.from({ length: padCount }, (_, i) => (
<Box key={`${card.id}:pad:${i}`} height={1} />
))}
</>
);
}

function SettledPreview({ card, allLines, lineCells }: BodyProps): React.ReactElement {
Expand Down
11 changes: 6 additions & 5 deletions src/cli/ui/cards/StreamingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export function StreamingCard({ card }: { card: StreamingCardData }): React.Reac
const allLines = card.text.length > 0 ? card.text.split("\n") : [""];
const visualLines = allLines.flatMap((l) => wrapToCells(l, lineCells));
const visible = visualLines.slice(-STREAMING_PREVIEW_LINES);
const padCount = Math.max(0, STREAMING_PREVIEW_LINES - visible.length);
const startIndex = allLines.length - visible.length;

return (
<CardBox color={card.aborted ? FG.faint : CARD.streaming.color}>
Expand All @@ -50,14 +52,13 @@ export function StreamingCard({ card }: { card: StreamingCardData }): React.Reac
</Box>
)}
{visible.map((line, i) => (
<Box
key={`${card.id}:${allLines.length - visible.length + i}`}
paddingLeft={BODY_PAD}
flexDirection="row"
>
<Box key={`${card.id}:${startIndex + i}`} paddingLeft={BODY_PAD} flexDirection="row">
<Text color={card.aborted ? FG.meta : FG.body}>{clipToCells(line, lineCells)}</Text>
</Box>
))}
{Array.from({ length: padCount }, (_, i) => (
<Box key={`${card.id}:pad:${i}`} height={1} />
))}
{card.aborted && (
<Box paddingLeft={BODY_PAD}>
<Text color={FG.faint}>{"[truncated by esc]"}</Text>
Expand Down
Loading