Skip to content

Commit

Permalink
refactor(group): clarify height subtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Jan 8, 2025
1 parent b10915b commit 50eb691
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
"github.com/charmbracelet/lipgloss"
)

const gap string = "\n\n"
const (
gap string = "\n\n"
helpMenuHeight int = 1
)

// Group is a collection of fields that are displayed together with a page of
// the form. While a group is displayed the form completer can switch between
Expand Down Expand Up @@ -270,7 +273,7 @@ func (g *Group) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

switch msg := msg.(type) {
case tea.WindowSizeMsg:
g.WithHeight(min(g.fullHeight(), msg.Height-1))
g.WithHeight(min(g.fullHeight(), msg.Height-helpMenuHeight))
g.WithWidth(msg.Width)
case nextFieldMsg:
cmds = append(cmds, g.nextField()...)
Expand Down

0 comments on commit 50eb691

Please sign in to comment.