@@ -9,6 +9,8 @@ import (
9 "github.com/charmbracelet/lipgloss/v2"
9 "github.com/charmbracelet/lipgloss/v2"
12+const maxCompletionsHeight = 10
12type Completion struct {
14type Completion struct {
13 Title string // The title of the completion item
15 Title string // The title of the completion item
14 Value any // The value of the completion item
16 Value any // The value of the completion item
@@ -153,7 +155,7 @@ func (c *completionsCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
153 var cmds []tea.Cmd
155 var cmds []tea.Cmd
154 cmds = append(cmds, c.list.Filter(msg.Query))
156 cmds = append(cmds, c.list.Filter(msg.Query))
155 itemsLen := len(c.list.Items())
157 itemsLen := len(c.list.Items())
156− c.height = max(min(10, itemsLen), 1)
158+ c.height = max(min(maxCompletionsHeight, itemsLen), 1)
157 cmds = append(cmds, c.list.SetSize(c.width, c.height))
159 cmds = append(cmds, c.list.SetSize(c.width, c.height))
158 if itemsLen == 0 {
160 if itemsLen == 0 {
159 // Close completions if no items match the query
161 // Close completions if no items match the query