diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-26 19:31:49 +1000 |
---|---|---|
committer | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2020-08-26 09:32:57 +0000 |
commit | 196c83d058d1e0945889484f887605353c32adb2 (patch) | |
tree | 276838c9e68b0d7339e04a9d2b207b578ba3b63d /pkg/gui/searching.go | |
parent | 806bee96460abea6a48f89640b8c42d9805e4e01 (diff) |
fix bug where cancelling search in menu caused issuev0.22.3
Diffstat (limited to 'pkg/gui/searching.go')
-rw-r--r-- | pkg/gui/searching.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pkg/gui/searching.go b/pkg/gui/searching.go index ddf595a5f..f00b799c9 100644 --- a/pkg/gui/searching.go +++ b/pkg/gui/searching.go @@ -23,11 +23,16 @@ func (gui *Gui) handleOpenSearch(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleSearch(g *gocui.Gui, v *gocui.View) error { gui.State.Searching.searchString = gui.getSearchView().Buffer() - if err := gui.switchContextToView(gui.State.Searching.view.Name()); err != nil { + if err := gui.returnFromContext(); err != nil { return err } - if err := gui.State.Searching.view.Search(gui.State.Searching.searchString); err != nil { + view := gui.State.Searching.view + if view == nil { + return nil + } + + if err := view.Search(gui.State.Searching.searchString); err != nil { return err } @@ -86,9 +91,13 @@ func (gui *Gui) onSearchEscape() error { } func (gui *Gui) handleSearchEscape(g *gocui.Gui, v *gocui.View) error { - if err := gui.switchContextToView(gui.State.Searching.view.Name()); err != nil { + if err := gui.onSearchEscape(); err != nil { return err } - return gui.onSearchEscape() + if err := gui.returnFromContext(); err != nil { + return err + } + + return nil } |