From 4abc462f8ee660989cd67564831edc4eed7c7fee Mon Sep 17 00:00:00 2001 From: themanyone Date: Thu, 28 May 2026 05:22:29 -0800 Subject: [PATCH] fix: also populate stash when starting with a document --- ui/ui.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/ui.go b/ui/ui.go index b2deeec..9a295c0 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -117,6 +117,7 @@ type model struct { func (m *model) unloadDocument() []tea.Cmd { m.state = stateShowStash m.stash.viewState = stashStateReady + m.stash.markdowns = nil m.pager.unload() m.pager.showHelp = false @@ -128,6 +129,12 @@ func (m *model) unloadDocument() []tea.Cmd { if !m.stash.shouldSpin() { batch = append(batch, m.stash.spinner.Tick) } + + // If we are transitioning from a document to the stash, we need to populate the stash. + if m.common.cwd != "" { + batch = append(batch, findLocalFiles(*m.common)) + } + return batch } @@ -397,6 +404,9 @@ func findLocalFiles(m commonModel) tea.Cmd { info, err = os.Stat(cwd) if err == nil && info.IsDir() { cwd, err = filepath.Abs(cwd) + } else if err == nil { + cwd = filepath.Dir(cwd) + cwd, err = filepath.Abs(cwd) } }