fix: pagination with multiline(true)

See #689
This commit is contained in:
2025-10-03 20:13:35 +02:00
parent 9c648a2566
commit 2460dd9438

View File

@ -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))