mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
centralise setting of main views context
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
)
|
||||
|
||||
@@ -104,6 +106,10 @@ func (gui *Gui) switchContext(c Context) error {
|
||||
gui.State.ContextStack = append(gui.State.ContextStack, c)
|
||||
}
|
||||
|
||||
if c.GetViewName() == "main" {
|
||||
gui.changeMainViewsContext(c.GetKey())
|
||||
}
|
||||
|
||||
return gui.activateContext(c)
|
||||
})
|
||||
|
||||
@@ -422,6 +428,8 @@ func (gui *Gui) changeMainViewsContext(context string) {
|
||||
case "normal", "patch-building", "staging", "merging":
|
||||
gui.getMainView().Context = context
|
||||
gui.getSecondaryView().Context = context
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown context for main: %s", context))
|
||||
}
|
||||
|
||||
gui.State.MainContext = context
|
||||
|
||||
Reference in New Issue
Block a user