on main help sign in
chore(tui/completions): pull out magic number
commit88077377e176c4940249502e4680d12c4e5c5aa3 authorChristian Rocha <christian@rocha.is> dateThu 10 Jul 2025, 21:33 (1 year ago) parent055b30f
1 file changed+3−1
internal/tui/components/completions/completions.go+3−1
internal/tui/components/completions/completions.go+3−1
@@ -9,6 +9,8 @@ import (
99 "github.com/charmbracelet/lipgloss/v2"
1010)
1111
12+const maxCompletionsHeight = 10
13+
1214type Completion struct {
1315 Title string // The title of the completion item
1416 Value any // The value of the completion item
@@ -153,7 +155,7 @@ func (c *completionsCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
153155 var cmds []tea.Cmd
154156 cmds = append(cmds, c.list.Filter(msg.Query))
155157 itemsLen := len(c.list.Items())
156− c.height = max(min(10, itemsLen), 1)
158+ c.height = max(min(maxCompletionsHeight, itemsLen), 1)
157159 cmds = append(cmds, c.list.SetSize(c.width, c.height))
158160 if itemsLen == 0 {
159161 // Close completions if no items match the query