mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
tui: fix autocomplete display to prevent long file paths from breaking layout
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user