1
0
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:
Jesse Duffield
2020-08-19 08:04:39 +10:00
parent 2488e0044d
commit f0c3d3fc4d
5 changed files with 8 additions and 6 deletions

View File

@@ -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