1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-14 11:23:09 +02:00
lazygit/pkg/gui/context.go

20 lines
609 B
Go
Raw Normal View History

2019-02-16 12:01:17 +02:00
package gui
2019-11-16 03:41:04 +02:00
// changeContext is a helper function for when we want to change a 'main' context
// which currently just means a context that affects both the main and secondary views
// other views can have their context changed directly but this function helps
// keep the main and secondary views in sync
func (gui *Gui) changeMainViewsContext(context string) {
2019-11-16 03:41:04 +02:00
if gui.State.MainContext == context {
return
2019-02-16 12:01:17 +02:00
}
2019-11-16 03:41:04 +02:00
switch context {
case "normal", "patch-building", "staging", "merging":
gui.getMainView().Context = context
gui.getSecondaryView().Context = context
2019-02-16 12:01:17 +02:00
}
2019-11-16 03:41:04 +02:00
gui.State.MainContext = context
2019-02-16 12:01:17 +02:00
}