Load the whole stash, page by page, automatically

This commit is contained in:
Christian Rocha 2020-11-20 12:57:03 -05:00
commit c16a146c00
No known key found for this signature in database
GPG key ID: D6CC7A16E5878018
2 changed files with 6 additions and 4 deletions

View file

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

View file

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