From 53da858c0681654d37c5c7f9232a54a3ee9f6892 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 21 Aug 2020 21:05:21 +1000 Subject: [PATCH] escape patch building mode on hitting escape at the top level --- pkg/gui/quitting.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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") {