diff options
author | Giorgio Previtera <giorgioprevitera@gmail.com> | 2019-10-26 22:45:44 +0100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-10-27 12:39:08 +1100 |
commit | a1c66194012d92cf24cc00cd021f654b958a3371 (patch) | |
tree | e9ebce2aaba44f999460bf530a34e3831cf785c5 /pkg/gui | |
parent | 3524f6baa95f73cbe6cbd90335cebaeb158667a3 (diff) |
\#480 Close popup panels before switching to a side view0.8.3
Reusing the `onNewPopupPanel` function to close existing popup panels
(if any) before switching to a new side view. Alse closing any
confirmation prompt.
Diffstat (limited to 'pkg/gui')
-rw-r--r-- | pkg/gui/view_helpers.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 7426ce18f..97f394ec3 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -146,10 +146,25 @@ func (gui *Gui) goToSideView(sideViewName string) func(g *gocui.Gui, v *gocui.Vi gui.Log.Error(err) return nil } + err = gui.closePopupPanels() + if err != nil { + gui.Log.Error(err) + return nil + } return gui.switchFocus(g, nil, view) } } +func (gui *Gui) closePopupPanels() error { + gui.onNewPopupPanel() + err := gui.closeConfirmationPrompt(gui.g) + if err != nil { + gui.Log.Error(err) + return err + } + return nil +} + // pass in oldView = nil if you don't want to be able to return to your old view // TODO: move some of this logic into our onFocusLost and onFocus hooks func (gui *Gui) switchFocus(g *gocui.Gui, oldView, newView *gocui.View) error { |