From c16a146c00340654e44ec2dcc061aa5ed6f4a1da Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Fri, 20 Nov 2020 12:57:03 -0500 Subject: [PATCH] Load the whole stash, page by page, automatically --- ui/stash.go | 7 ++++++- ui/ui.go | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/stash.go b/ui/stash.go index c493089..a790460 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -383,9 +383,14 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) { m.loadingFromNetwork = false docs = wrapMarkdowns(stashedMarkdown, msg) - // If the server comes back with nothing then we've got everything if len(msg) == 0 { + // If the server comes back with nothing then we've got + // everything m.stashFullyLoaded = true + } else { + // Load the next page + m.page++ + cmds = append(cmds, loadStash(m)) } case gotNewsMsg: diff --git a/ui/ui.go b/ui/ui.go index ce432b0..d690235 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -315,9 +315,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.stash.setSize(msg.Width, msg.Height) m.pager.setSize(msg.Width, msg.Height) - // TODO: load more stash pages if we've resized, are on the last page, - // and haven't loaded more pages yet. - case initLocalFileSearchMsg: m.localFileFinder = msg.ch m.general.cwd = msg.cwd