From 88077377e176c4940249502e4680d12c4e5c5aa3 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 10 Jul 2025 21:33:59 -0400 Subject: [PATCH] chore(tui/completions): pull out magic number --- internal/tui/components/completions/completions.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/tui/components/completions/completions.go b/internal/tui/components/completions/completions.go index e9c410d37a91ac245b7766cb7b1469dd4b421eda..5a6bcfe92e23f38c3f40c84770a0dcc9893e59d5 100644 --- a/internal/tui/components/completions/completions.go +++ b/internal/tui/components/completions/completions.go @@ -9,6 +9,8 @@ import ( "github.com/charmbracelet/lipgloss/v2" ) +const maxCompletionsHeight = 10 + type Completion struct { Title string // The title of the completion item Value any // The value of the completion item @@ -153,7 +155,7 @@ func (c *completionsCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmds []tea.Cmd cmds = append(cmds, c.list.Filter(msg.Query)) itemsLen := len(c.list.Items()) - c.height = max(min(10, itemsLen), 1) + c.height = max(min(maxCompletionsHeight, itemsLen), 1) cmds = append(cmds, c.list.SetSize(c.width, c.height)) if itemsLen == 0 { // Close completions if no items match the query