diff --git a/pkg/gui/quitting.go b/pkg/gui/quitting.go index 107538a39..6f1b77e29 100644 --- a/pkg/gui/quitting.go +++ b/pkg/gui/quitting.go @@ -35,6 +35,12 @@ func (gui *Gui) handleQuit() 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() { return gui.exitDiffMode() } @@ -42,10 +48,8 @@ func (gui *Gui) handleTopLevelReturn(g *gocui.Gui, v *gocui.View) error { return gui.exitFilterMode() } - 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 - gui.switchContext(currentContext.GetParentContext()) + if gui.GitCommand.PatchManager.Active() { + return gui.handleResetPatch() } if gui.Config.GetUserConfig().GetBool("quitOnTopLevelReturn") {