From 94601b4dc951de9b1efa08120148d2d9766b637c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 23 Aug 2020 12:20:49 +1000 Subject: use context to return to the correct view --- pkg/gui/commit_files_panel.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'pkg/gui/commit_files_panel.go') diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index 65ac9a936..505beda0e 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -59,10 +59,8 @@ func (gui *Gui) handleDiscardOldFileChange(g *gocui.Gui, v *gocui.View) error { fileName := gui.State.CommitFiles[gui.State.Panels.CommitFiles.SelectedLineIdx].Name return gui.ask(askOpts{ - returnToView: v, - returnFocusOnClose: true, - title: gui.Tr.SLocalize("DiscardFileChangesTitle"), - prompt: gui.Tr.SLocalize("DiscardFileChangesPrompt"), + title: gui.Tr.SLocalize("DiscardFileChangesTitle"), + prompt: gui.Tr.SLocalize("DiscardFileChangesPrompt"), handleConfirm: func() error { return gui.WithWaitingStatus(gui.Tr.SLocalize("RebasingStatus"), func() error { if err := gui.GitCommand.DiscardOldFileChanges(gui.State.Commits, gui.State.Panels.Commits.SelectedLineIdx, fileName); err != nil { @@ -139,10 +137,8 @@ func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error { if gui.GitCommand.PatchManager.Active() && gui.GitCommand.PatchManager.To != commitFile.Parent { return gui.ask(askOpts{ - returnToView: v, - returnFocusOnClose: true, - title: gui.Tr.SLocalize("DiscardPatch"), - prompt: gui.Tr.SLocalize("DiscardPatchConfirm"), + title: gui.Tr.SLocalize("DiscardPatch"), + prompt: gui.Tr.SLocalize("DiscardPatchConfirm"), handleConfirm: func() error { gui.GitCommand.PatchManager.Reset() return toggleTheFile() @@ -189,10 +185,8 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error { if gui.GitCommand.PatchManager.Active() && gui.GitCommand.PatchManager.To != commitFile.Parent { return gui.ask(askOpts{ - returnToView: gui.getCommitFilesView(), - returnFocusOnClose: false, - title: gui.Tr.SLocalize("DiscardPatch"), - prompt: gui.Tr.SLocalize("DiscardPatchConfirm"), + title: gui.Tr.SLocalize("DiscardPatch"), + prompt: gui.Tr.SLocalize("DiscardPatchConfirm"), handleConfirm: func() error { gui.GitCommand.PatchManager.Reset() return enterTheFile(selectedLineIdx) -- cgit v1.2.3