From 70b427c7dd34ac0690e84a6133df59733bfb39e8 Mon Sep 17 00:00:00 2001 From: Jacob Richman Date: Wed, 18 Feb 2026 22:39:54 -0800 Subject: [PATCH] fix spacing (#19494) --- .../src/ui/components/MainContent.test.tsx | 59 +++++++++++++++++++ .../__snapshots__/MainContent.test.tsx.snap | 15 +++++ .../components/messages/ToolGroupMessage.tsx | 2 +- 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/MainContent.test.tsx b/packages/cli/src/ui/components/MainContent.test.tsx index eb854324cc..fce375c306 100644 --- a/packages/cli/src/ui/components/MainContent.test.tsx +++ b/packages/cli/src/ui/components/MainContent.test.tsx @@ -427,6 +427,65 @@ describe('MainContent', () => { unmount(); }); + it('renders a split tool group without a gap between static and pending areas', async () => { + const toolCalls = [ + { + callId: 'tool-1', + name: 'test-tool', + description: 'A tool for testing', + resultDisplay: 'Part 1', + status: CoreToolCallStatus.Success, + } as IndividualToolCallDisplay, + ]; + + const pendingToolCalls = [ + { + callId: 'tool-2', + name: 'test-tool', + description: 'A tool for testing', + resultDisplay: 'Part 2', + status: CoreToolCallStatus.Success, + } as IndividualToolCallDisplay, + ]; + + const uiState = { + ...defaultMockUiState, + history: [ + { + id: 1, + type: 'tool_group' as const, + tools: toolCalls, + borderBottom: false, + }, + ], + pendingHistoryItems: [ + { + type: 'tool_group' as const, + tools: pendingToolCalls, + borderTop: false, + borderBottom: true, + }, + ], + }; + + const { lastFrame, waitUntilReady, unmount } = renderWithProviders( + , + { + uiState: uiState as Partial, + }, + ); + await waitUntilReady(); + + const output = lastFrame(); + // Verify Part 1 and Part 2 are rendered. + expect(output).toContain('Part 1'); + expect(output).toContain('Part 2'); + + // The snapshot will be the best way to verify there is no gap (empty line) between them. + expect(output).toMatchSnapshot(); + unmount(); + }); + describe('MainContent Tool Output Height Logic', () => { const testCases = [ { diff --git a/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap index 8fbe2bd11e..29eda04bab 100644 --- a/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap @@ -107,3 +107,18 @@ exports[`MainContent > MainContent Tool Output Height Logic > 'Normal mode - Unc ShowMoreLines " `; + +exports[`MainContent > renders a split tool group without a gap between static and pending areas 1`] = ` +"AppHeader(full) +╭──────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ✓ test-tool A tool for testing │ +│ │ +│ Part 1 │ +│ │ +│ ✓ test-tool A tool for testing │ +│ │ +│ Part 2 │ +╰──────────────────────────────────────────────────────────────────────────────────────────────╯ +ShowMoreLines +" +`; diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx index c9c7171277..f4e1c200db 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx @@ -148,7 +148,7 @@ export const ToolGroupMessage: React.FC = ({ */ width={terminalWidth} paddingRight={TOOL_MESSAGE_HORIZONTAL_MARGIN} - marginBottom={1} + marginBottom={borderBottomOverride === false ? 0 : 1} > {visibleToolCalls.map((tool, index) => { const isFirst = index === 0;