diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 16:36:39 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-15 18:01:43 +1000 |
commit | d9fa02c53bb9b401f1b5ca07e8ed239862052a42 (patch) | |
tree | 9ce89793ba22ffc190ab6133365035dda4ec1ade /pkg/gui/undoing.go | |
parent | c44ee71ad4ca44a407613c1e91f7d720acfa84f6 (diff) |
clean up interface for popup panels
Diffstat (limited to 'pkg/gui/undoing.go')
-rw-r--r-- | pkg/gui/undoing.go | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/pkg/gui/undoing.go b/pkg/gui/undoing.go index 06057af37..7bc128b89 100644 --- a/pkg/gui/undoing.go +++ b/pkg/gui/undoing.go @@ -166,24 +166,30 @@ func (gui *Gui) handleHardResetWithAutoStash(commitSha string, options handleHar dirtyWorkingTree := len(gui.trackedFiles()) > 0 if dirtyWorkingTree { // offer to autostash changes - return gui.createConfirmationPanel(gui.g, gui.getBranchesView(), true, gui.Tr.SLocalize("AutoStashTitle"), gui.Tr.SLocalize("AutoStashPrompt"), func(g *gocui.Gui, v *gocui.View) error { - return gui.WithWaitingStatus(options.WaitingStatus, func() error { - if err := gui.GitCommand.StashSave(gui.Tr.SLocalize("StashPrefix") + commitSha); err != nil { - return gui.surfaceError(err) - } - if err := reset(); err != nil { - return err - } - - if err := gui.GitCommand.StashDo(0, "pop"); err != nil { - if err := gui.refreshSidePanels(refreshOptions{}); err != nil { + return gui.createConfirmationPanel(createConfirmationPanelOpts{ + returnToView: gui.getBranchesView(), + returnFocusOnClose: true, + title: gui.Tr.SLocalize("AutoStashTitle"), + prompt: gui.Tr.SLocalize("AutoStashPrompt"), + handleConfirm: func() error { + return gui.WithWaitingStatus(options.WaitingStatus, func() error { + if err := gui.GitCommand.StashSave(gui.Tr.SLocalize("StashPrefix") + commitSha); err != nil { + return gui.surfaceError(err) + } + if err := reset(); err != nil { return err } - return gui.surfaceError(err) - } - return nil - }) - }, nil) + + if err := gui.GitCommand.StashDo(0, "pop"); err != nil { + if err := gui.refreshSidePanels(refreshOptions{}); err != nil { + return err + } + return gui.surfaceError(err) + } + return nil + }) + }, + }) } return gui.WithWaitingStatus(options.WaitingStatus, func() error { |