From 2460dd94380a60abfd442f3831ebbecbd536fcb9 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 3 Oct 2025 20:13:35 +0200 Subject: [PATCH] fix: pagination with multiline(true) See https://git.coopcloud.tech/toolshed/abra/issues/689 --- cli/app/list.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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))