1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-01 22:52:01 +02:00

simplify how the context system works

This commit is contained in:
Jesse Duffield
2019-11-10 16:33:31 +11:00
parent e85310c0a9
commit 131113b065
11 changed files with 362 additions and 374 deletions

View File

@@ -155,7 +155,7 @@ type guiState struct {
Updating bool
Panels *panelStates
WorkingTreeState string // one of "merging", "rebasing", "normal"
Contexts map[string]string
Context string // important not to set this value directly but to use gui.changeContext("new context")
CherryPickedCommits []*commands.Commit
SplitMainPanel bool
}
@@ -281,11 +281,11 @@ func (gui *Gui) onFocusLost(v *gocui.View, newView *gocui.View) error {
}
case "main":
// if we have lost focus to a first-class panel, we need to do some cleanup
if err := gui.changeContext("main", "normal"); err != nil {
if err := gui.changeContext("normal"); err != nil {
return err
}
case "commitFiles":
if gui.State.Contexts["main"] != "patch-building" {
if gui.State.Context != "patch-building" {
if _, err := gui.g.SetViewOnBottom(v.Name()); err != nil {
return err
}