1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00
This commit is contained in:
Jesse Duffield
2022-02-13 12:47:15 +11:00
parent 33a223e981
commit 55af07a1bb
4 changed files with 22 additions and 15 deletions

View File

@ -43,13 +43,12 @@ func (gui *Gui) currentContextKeyIgnoringPopups() types.ContextKey {
// use replaceContext when you don't want to return to the original context upon
// hitting escape: you want to go that context's parent instead.
func (gui *Gui) replaceContext(c types.Context) error {
gui.State.ContextManager.Lock()
defer gui.State.ContextManager.Unlock()
if !c.IsFocusable() {
return nil
}
gui.State.ContextManager.Lock()
if len(gui.State.ContextManager.ContextStack) == 0 {
gui.State.ContextManager.ContextStack = []types.Context{c}
} else {
@ -57,6 +56,8 @@ func (gui *Gui) replaceContext(c types.Context) error {
gui.State.ContextManager.ContextStack = append(gui.State.ContextManager.ContextStack[0:len(gui.State.ContextManager.ContextStack)-1], c)
}
defer gui.State.ContextManager.Unlock()
return gui.activateContext(c)
}