diff --git a/ui/stash.go b/ui/stash.go index a2ecf64..41b6d18 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -66,6 +66,12 @@ func (m *stashModel) SetSize(width, height int) { // Update the paginator perPage := (m.terminalHeight - topPadding - bottomPadding) / itemHeight m.paginator.PerPage = perPage + m.paginator.SetTotalPages(len(m.documents)) + + // Make sure the page stays in bounds + if m.paginator.Page >= m.paginator.TotalPages-1 { + m.paginator.Page = m.paginator.TotalPages - 1 + } } // INIT diff --git a/ui/ui.go b/ui/ui.go index 40fb503..f43c64a 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -151,6 +151,8 @@ func update(msg boba.Msg, mdl boba.Model) (boba.Model, boba.Cmd) { m.terminalWidth = w m.terminalHeight = h m.stash.SetSize(w, h) + // TODO: load more stash pages if we've resized, are on the last page, + // and haven't loaded more pages yet. return m, nil case sshAuthErrMsg: