mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 14:14:17 +00:00
Stashed docs become local upon delete if they were stashed in-session
This commit is contained in:
parent
cdf11136f4
commit
2fdef64478
1 changed files with 9 additions and 3 deletions
12
ui/stash.go
12
ui/stash.go
|
@ -522,9 +522,15 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) {
|
|||
i := m.markdownIndex()
|
||||
id := m.markdowns[i].ID
|
||||
|
||||
// Delete optimistically and remove the stashed item
|
||||
// before we've received a success response.
|
||||
m.markdowns = append(m.markdowns[:i], m.markdowns[i+1:]...)
|
||||
if m.markdowns[i].markdownType == convertedMarkdown {
|
||||
// If document was stashed during this session, convert it
|
||||
// back to a local file.
|
||||
m.markdowns[i].markdownType = localMarkdown
|
||||
} else {
|
||||
// Delete optimistically and remove the stashed item
|
||||
// before we've received a success response.
|
||||
m.markdowns = append(m.markdowns[:i], m.markdowns[i+1:]...)
|
||||
}
|
||||
|
||||
// Update pagination
|
||||
m.paginator.SetTotalPages(len(m.markdowns))
|
||||
|
|
Loading…
Reference in a new issue