tui: fix autocomplete display to prevent long file paths from breaking layout
parent
6f37315cd1
commit
ad83dd3ad9
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue