Skip to content

The open source coding agent.

TypeScript

fix(tui): constrain autocomplete height to available screen space (#7181)

Ravi Kumar68cf6b04a0ee
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 8a6db34242a..57eac9544e6 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
@@ -653,8 +653,10 @@ export function Autocomplete(props: {
})
const height = createMemo(() => {
- if (options().length) return Math.min(10, options().length)
- return 1
+ const count = options().length || 1
+ if (!store.visible) return Math.min(10, count)
+ positionTick()
+ return Math.min(10, count, Math.max(1, props.anchor().y))
})
let scroll: ScrollBoxRenderable