tui: improve autocomplete component styling and update test command

This commit is contained in:
Dax Raad
2025-10-31 16:21:18 -04:00
parent 81b94d84dc
commit aae0ce9921

View File

@@ -334,8 +334,8 @@ export function Autocomplete(props: {
if (e.name === "up") move(-1)
if (e.name === "down") move(1)
if (e.name === "escape") hide()
if (e.name === "return") select()
if (["up", "down", "return", "escape"].includes(e.name)) e.preventDefault()
if (e.name === "return" || e.name === "tab") select()
if (["up", "down", "return", "tab", "escape"].includes(e.name)) e.preventDefault()
}
if (!store.visible) {
if (e.name === "@") {
@@ -391,11 +391,14 @@ export function Autocomplete(props: {
backgroundColor={index() === store.selected ? theme.primary : undefined}
flexDirection="row"
>
<text fg={index() === store.selected ? theme.background : theme.text}>
<text fg={index() === store.selected ? theme.background : theme.text} flexShrink={0}>
{option.display}
</text>
<Show when={option.description}>
<text fg={index() === store.selected ? theme.background : theme.textMuted}>
<text
fg={index() === store.selected ? theme.background : theme.textMuted}
wrapMode="none"
>
{option.description}
</text>
</Show>