1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-27 00:51:18 +02:00

escape patch building mode on hitting escape at the top level

This commit is contained in:
Jesse Duffield
2020-08-21 21:05:21 +10:00
parent 50c9ae863a
commit 53da858c06

View File

@ -35,6 +35,12 @@ func (gui *Gui) handleQuit() error {
} }
func (gui *Gui) handleTopLevelReturn(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleTopLevelReturn(g *gocui.Gui, v *gocui.View) error {
currentContext := gui.currentContext()
if currentContext != nil && currentContext.GetParentContext() != nil {
// TODO: think about whether this should be marked as a return rather than adding to the stack
return gui.switchContext(currentContext.GetParentContext())
}
if gui.inDiffMode() { if gui.inDiffMode() {
return gui.exitDiffMode() return gui.exitDiffMode()
} }
@ -42,10 +48,8 @@ func (gui *Gui) handleTopLevelReturn(g *gocui.Gui, v *gocui.View) error {
return gui.exitFilterMode() return gui.exitFilterMode()
} }
currentContext := gui.currentContext() if gui.GitCommand.PatchManager.Active() {
if currentContext != nil && currentContext.GetParentContext() != nil { return gui.handleResetPatch()
// TODO: think about whether this should be marked as a return rather than adding to the stack
gui.switchContext(currentContext.GetParentContext())
} }
if gui.Config.GetUserConfig().GetBool("quitOnTopLevelReturn") { if gui.Config.GetUserConfig().GetBool("quitOnTopLevelReturn") {