diff --git a/cli/app/list.go b/cli/app/list.go index 73839ff1..aeba022d 100644 --- a/cli/app/list.go +++ b/cli/app/list.go @@ -512,7 +512,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.table = msg.table m.table = m.table.WithTargetWidth(m.width) - m.table = m.table.WithPageSize(m.height - 10) + m.table = m.table.WithPageSize(calculateHeight(m)) if m.initStatusGather { m.pollingStatus = true @@ -526,7 +526,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.height = msg.Height m.table = m.table.WithTargetWidth(m.width) - m.table = m.table.WithPageSize(m.height - 10) + m.table = m.table.WithPageSize(calculateHeight(m)) case errorMsg: m.err = msg } @@ -540,6 +540,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Batch(cmds...) } +func calculateHeight(m model) int { + return m.height/2 - 5 +} + func (m model) View() string { if m.err != nil { return fmt.Sprintf("FATA: %v", m.err) @@ -554,7 +558,7 @@ func (m model) View() string { m.numFilteredServers, m.numFilteredApps, m.numFilteredRecipes, ) - help := "[q] quit • [/] filter • [s] status" + help := "[q] quit • [/] filter • [s] status • [ctrl+u/d] page up/down" body.WriteString(lipgloss.JoinHorizontal(lipgloss.Center, stats, " | ", help))