diff --git a/packages/tui/src/routes/session/index.tsx b/packages/tui/src/routes/session/index.tsx index 054d35d405..7f508fe226 100644 --- a/packages/tui/src/routes/session/index.tsx +++ b/packages/tui/src/routes/session/index.tsx @@ -2327,11 +2327,13 @@ function Shell(props: ToolProps) { const [expanded, setExpanded] = createSignal(false) const maxLines = 10 const maxChars = createMemo(() => maxLines * Math.max(20, ctx.width - 6)) - const input = createMemo(() => (command() ? `${isRunning() ? "" : "$ "}${command()}` : "")) - const content = createMemo(() => [input(), output()].filter(Boolean).join("\n\n")) - const collapsed = createMemo(() => collapseToolOutput(content(), maxLines, maxChars())) + const input = createMemo(() => { + const value = command()?.replace(/\s+/g, " ").trim() + return value ? `${isRunning() ? "" : "$ "}${value}` : "" + }) + const collapsed = createMemo(() => collapseToolOutput(output(), maxLines, maxChars())) const limited = createMemo(() => { - if (expanded() || !collapsed().overflow) return content() + if (expanded() || !collapsed().overflow) return output() return collapsed().output }) @@ -2348,23 +2350,20 @@ function Shell(props: ToolProps) { ) } > - - {limited().slice(0, input().length)} - {limited().slice(input().length)} - - } - > - - {limited().slice(0, input().length)} - {limited().slice(input().length)} - - + + + + + + {input()} + + + Background + + - - Background + + {limited()} {expanded() ? "Click to collapse" : "Click to expand"}