diff options
| author | Dax Raad <[email protected]> | 2025-11-11 21:35:13 -0500 |
|---|---|---|
| committer | opencode <[email protected]> | 2025-11-12 02:36:43 +0000 |
| commit | ad83dd3ad99cb6ec37c482d7f09485fd3689c420 (patch) | |
| tree | 31b615edfacb6b7160114af178e4bc7b5bc0a2c4 /packages | |
| parent | 6f37315cd1150aea1ac688d82adc8add469f7478 (diff) | |
| download | opencode-ad83dd3ad99cb6ec37c482d7f09485fd3689c420.tar.gz opencode-ad83dd3ad99cb6ec37c482d7f09485fd3689c420.zip | |
tui: fix autocomplete display to prevent long file paths from breaking layout
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx index a776b5f95..cb7be2f45 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx @@ -8,6 +8,7 @@ import { useSync } from "@tui/context/sync" import { useTheme } from "@tui/context/theme" import { SplitBorder } from "@tui/component/border" import { useCommandDialog } from "@tui/component/dialog-command" +import { Locale } from "@/util/locale" import type { PromptInfo } from "./history" export type AutocompleteRef = { @@ -125,10 +126,11 @@ export function Autocomplete(props: { // Add file options if (!result.error && result.data) { + const width = store.position.width - 4 options.push( ...result.data.map( (item): AutocompleteOption => ({ - display: item, + display: Locale.truncateMiddle(item, width), onSelect: () => { insertPart(item, { type: "file", |
