From eb5d30257a1074f481ad98204a1d8b6aab7a0048 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 21 May 2026 15:00:52 -0400 Subject: [PATCH] fix(tui): preserve inline tool left edge --- .../src/cli/cmd/tui/routes/session/index.tsx | 6 ++++-- .../inline-tool-wrap-snapshot.test.tsx.snap | 15 ++++++++------- .../cli/tui/inline-tool-wrap-snapshot.test.tsx | 14 +++++++++++--- 3 files changed, 23 insertions(+), 12 deletions(-) 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 f9caef33c1..43c0e41641 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1810,7 +1810,7 @@ function InlineTool(props: { } when={props.complete} > - + - {error()} + + {error()} + ) diff --git a/packages/opencode/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap b/packages/opencode/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap index 8662b81348..e2f5d53037 100644 --- a/packages/opencode/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap +++ b/packages/opencode/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap @@ -1,11 +1,12 @@ // Bun Snapshot v1, https://bun.sh/docs/test/snapshots exports[`TUI inline tool wrapping snapshots consecutive grep, glob, and read rows at a narrow width 1`] = ` -" * Grep "OPENCODE.*DB|database|sqlite|drizzle|dev.*db|data. - *dir|xdg|APPDATA" in packages/opencode/src (151 matches) - * Glob "**/*db*" in packages/opencode (6 matches) - -> Read packages/opencode/src/storage/db.ts [offset=1, limit=130] - -> Read packages/opencode/src/index.ts [offset=1, limit=100] - * Grep "export const OPENCODE_DB|OPENCODE_DB|OPENCODE_DEV|Global\\. - Path\\.data|data =" in packages/opencode/src (115 matches)" +" * Grep "OPENCODE.*DB|database|sqlite|drizzle|dev.*db|data. + *dir|xdg|APPDATA" in packages/opencode/src (151 matches) + * Glob "**/*db*" in packages/opencode (6 matches) + -> Read packages/opencode/src/storage/db.ts [offset=1, limit=130] + -> Read packages/opencode/src/index.ts [offset=1, limit=100] + No LSP server available for this file type. + * Grep "export const OPENCODE_DB|OPENCODE_DB|OPENCODE_DEV|Global\\. + Path\\.data|data =" in packages/opencode/src (115 matches)" `; diff --git a/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx b/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx index 72388c5560..99592e9b9f 100644 --- a/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx +++ b/packages/opencode/test/cli/tui/inline-tool-wrap-snapshot.test.tsx @@ -9,7 +9,9 @@ afterEach(() => { testSetup = undefined }) -const tools = [ +type ToolFixture = { icon: string; label: string; error?: string } + +const tools: readonly ToolFixture[] = [ { icon: "*", label: @@ -26,6 +28,7 @@ const tools = [ { icon: "->", label: "Read packages/opencode/src/index.ts [offset=1, limit=100]", + error: "No LSP server available for this file type.", }, { icon: "*", @@ -34,13 +37,18 @@ const tools = [ }, ] as const -function InlineToolRow(props: { item: (typeof tools)[number] }) { +function InlineToolRow(props: { item: ToolFixture }) { return ( - + {props.item.icon} {props.item.label} + {props.item.error && ( + + {props.item.error} + + )} ) }