mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-15 01:34:26 +02:00
\#480 Close popup panels before switching to a side view
Reusing the `onNewPopupPanel` function to close existing popup panels (if any) before switching to a new side view. Alse closing any confirmation prompt.
This commit is contained in:
committed by
Jesse Duffield
parent
3524f6baa9
commit
a1c6619401
@ -146,10 +146,25 @@ func (gui *Gui) goToSideView(sideViewName string) func(g *gocui.Gui, v *gocui.Vi
|
|||||||
gui.Log.Error(err)
|
gui.Log.Error(err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
err = gui.closePopupPanels()
|
||||||
|
if err != nil {
|
||||||
|
gui.Log.Error(err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return gui.switchFocus(g, nil, view)
|
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
|
// 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
|
// TODO: move some of this logic into our onFocusLost and onFocus hooks
|
||||||
func (gui *Gui) switchFocus(g *gocui.Gui, oldView, newView *gocui.View) error {
|
func (gui *Gui) switchFocus(g *gocui.Gui, oldView, newView *gocui.View) error {
|
||||||
|
Reference in New Issue
Block a user