diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index 6f18f02a9..8ca86209e 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1793,7 +1793,7 @@ function InlineTool(props: { const children = parent.getChildren() const index = children.indexOf(el) const previous = children[index - 1] - setMargin(previous?.id.startsWith("text-") ? 1 : 0) + setMargin(previous?.id.startsWith("text-") || previous?.id.startsWith("tool-block-") ? 1 : 0) }} > @@ -1850,6 +1850,7 @@ function BlockTool(props: { const error = createMemo(() => (props.part?.state.status === "error" ? props.part.state.error : undefined)) return ( @@ -65,10 +66,23 @@ function InlineToolRow(props: { item: ToolFixture; errorExpanded?: boolean }) { ) } -function Fixture(props: { errorExpanded?: boolean }) { +function ShellOutput() { + return ( + + # List files + + $ ls + file.ts + + + ) +} + +function Fixture(props: { errorExpanded?: boolean; shellOutput?: boolean }) { return ( + {props.shellOutput && } {(item) => } @@ -105,4 +119,19 @@ describe("TUI inline tool wrapping", () => { .trimEnd(), ).toMatchSnapshot() }) + + test("keeps separation after a shell output block", async () => { + testSetup = await testRender(() => , { width: 72, height: 16 }) + await testSetup.renderOnce() + await testSetup.renderOnce() + + expect( + testSetup + .captureCharFrame() + .split("\n") + .map((line) => line.trimEnd()) + .join("\n") + .trimEnd(), + ).toMatchSnapshot() + }) })