mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Maintain previous filtering after unloading a document
This commit is contained in:
parent
6965caf3af
commit
75528db9f1
2 changed files with 6 additions and 7 deletions
|
@ -221,7 +221,6 @@ func (m *stashModel) getNotes() []*markdown {
|
|||
if m.searchInput.Value() == "" {
|
||||
return m.markdowns
|
||||
}
|
||||
|
||||
if m.state != stashStateSearchNotes &&
|
||||
m.state != stashStateShowFiltered &&
|
||||
m.state != stashStatePromptDelete &&
|
||||
|
@ -480,11 +479,6 @@ func stashUpdate(msg tea.Msg, m stashModel) (stashModel, tea.Cmd) {
|
|||
md := m.selectedMarkdown()
|
||||
m.state = stashStateLoadingDocument
|
||||
|
||||
// This is only relevant when "enter" was called from the
|
||||
// filtered stash view
|
||||
m.searchInput.SetValue("")
|
||||
m.setTotalPages()
|
||||
|
||||
if md.markdownType == localMarkdown {
|
||||
cmds = append(cmds, loadLocalMarkdown(md))
|
||||
} else {
|
||||
|
|
7
ui/ui.go
7
ui/ui.go
|
@ -156,10 +156,15 @@ type model struct {
|
|||
// method alters the model we also need to send along any commands returned.
|
||||
func (m *model) unloadDocument() []tea.Cmd {
|
||||
m.state = stateShowStash
|
||||
m.stash.state = stashStateReady
|
||||
m.pager.unload()
|
||||
m.pager.showHelp = false
|
||||
|
||||
if m.stash.searchInput.Value() == "" {
|
||||
m.stash.state = stashStateReady
|
||||
} else {
|
||||
m.stash.state = stashStateShowFiltered
|
||||
}
|
||||
|
||||
var batch []tea.Cmd
|
||||
if m.pager.viewport.HighPerformanceRendering {
|
||||
batch = append(batch, tea.ClearScrollArea)
|
||||
|
|
Loading…
Reference in a new issue