mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-12 11:15:00 +02:00
64782a433e
The state object is sometimes undefined in the onclick method of the line by line panel. Because we set it to nil in a bunch of places, I've decided to just change the main context to 'normal' before setting it to nil anywhere. That way the keybindings for the line by line panel won't get executed and we won't get a segfault.
21 lines
617 B
Go
21 lines
617 B
Go
package gui
|
|
|
|
// 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) {
|
|
if gui.State.MainContext == context {
|
|
return
|
|
}
|
|
|
|
switch context {
|
|
case "normal", "patch-building", "staging", "merging":
|
|
gui.getMainView().Context = context
|
|
gui.getSecondaryView().Context = context
|
|
}
|
|
|
|
gui.State.MainContext = context
|
|
return
|
|
}
|