The open source coding agent.
TypeScript
tui: fix autocomplete display to prevent long file paths from breaking layout
Dax Raadad83dd3ad99c
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsxindex a776b5f9518..cb7be2f4521 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 optionsif (!result.error && result.data) {+ const width = store.position.width - 4options.push(...result.data.map((item): AutocompleteOption => ({- display: item,+ display: Locale.truncateMiddle(item, width),onSelect: () => {insertPart(item, {type: "file",