diff options
-rw-r--r-- | pkg/gui/branches_panel.go | 20 | ||||
-rw-r--r-- | pkg/gui/commit_files_panel.go | 6 | ||||
-rw-r--r-- | pkg/gui/commits_panel.go | 20 | ||||
-rw-r--r-- | pkg/gui/confirmation_panel.go | 8 | ||||
-rw-r--r-- | pkg/gui/diffing.go | 2 | ||||
-rw-r--r-- | pkg/gui/files_panel.go | 16 | ||||
-rw-r--r-- | pkg/gui/filtering.go | 2 | ||||
-rw-r--r-- | pkg/gui/filtering_menu_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/git_flow.go | 2 | ||||
-rw-r--r-- | pkg/gui/gui.go | 6 | ||||
-rw-r--r-- | pkg/gui/merge_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/patch_options_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/quitting.go | 2 | ||||
-rw-r--r-- | pkg/gui/rebase_options_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/reflog_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/remote_branches_panel.go | 6 | ||||
-rw-r--r-- | pkg/gui/remotes_panel.go | 10 | ||||
-rw-r--r-- | pkg/gui/staging_panel.go | 2 | ||||
-rw-r--r-- | pkg/gui/stash_panel.go | 8 | ||||
-rw-r--r-- | pkg/gui/tags_panel.go | 6 | ||||
-rw-r--r-- | pkg/gui/undoing.go | 2 | ||||
-rw-r--r-- | pkg/gui/updates.go | 4 |
22 files changed, 66 insertions, 66 deletions
diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 22dddb65e..df7825ed2 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -141,7 +141,7 @@ func (gui *Gui) handleForceCheckout(g *gocui.Gui, v *gocui.View) error { message := gui.Tr.SLocalize("SureForceCheckout") title := gui.Tr.SLocalize("ForceCheckoutBranch") - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: title, @@ -186,7 +186,7 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions) if strings.Contains(err.Error(), "Please commit your changes or stash them before you switch branch") { // offer to autostash changes - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getBranchesView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("AutoStashTitle"), @@ -222,11 +222,11 @@ func (gui *Gui) handleCheckoutRef(ref string, options handleCheckoutRefOptions) } func (gui *Gui) handleCheckoutByName(g *gocui.Gui, v *gocui.View) error { - return gui.createPromptPanel(v, gui.Tr.SLocalize("BranchName")+":", "", func(response string) error { + return gui.prompt(v, gui.Tr.SLocalize("BranchName")+":", "", func(response string) error { return gui.handleCheckoutRef(response, handleCheckoutRefOptions{ onRefNotFound: func(ref string) error { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("BranchNotFoundTitle"), @@ -259,7 +259,7 @@ func (gui *Gui) handleNewBranch(g *gocui.Gui, v *gocui.View) error { "branchName": branch.Name, }, ) - return gui.createPromptPanel(v, message, "", func(response string) error { + return gui.prompt(v, message, "", func(response string) error { return gui.createNewBranchWithName(response) }) } @@ -308,7 +308,7 @@ func (gui *Gui) deleteNamedBranch(g *gocui.Gui, v *gocui.View, selectedBranch *c }, ) - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: title, @@ -346,7 +346,7 @@ func (gui *Gui) mergeBranchIntoCheckedOutBranch(branchName string) error { }, ) - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getBranchesView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("MergingTitle"), @@ -389,7 +389,7 @@ func (gui *Gui) handleRebaseOntoBranch(selectedBranchName string) error { }, ) - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getBranchesView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("RebasingTitle"), @@ -537,7 +537,7 @@ func (gui *Gui) handleRenameBranch(g *gocui.Gui, v *gocui.View) error { // way to get it to show up in the reflog) promptForNewName := func() error { - return gui.createPromptPanel(v, gui.Tr.SLocalize("NewBranchNamePrompt")+" "+branch.Name+":", "", func(newBranchName string) error { + return gui.prompt(v, gui.Tr.SLocalize("NewBranchNamePrompt")+" "+branch.Name+":", "", func(newBranchName string) error { if err := gui.GitCommand.RenameBranch(branch.Name, newBranchName); err != nil { return gui.surfaceError(err) } @@ -559,7 +559,7 @@ func (gui *Gui) handleRenameBranch(g *gocui.Gui, v *gocui.View) error { return promptForNewName() } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("renameBranch"), diff --git a/pkg/gui/commit_files_panel.go b/pkg/gui/commit_files_panel.go index b10f0f4bb..720f77e55 100644 --- a/pkg/gui/commit_files_panel.go +++ b/pkg/gui/commit_files_panel.go @@ -77,7 +77,7 @@ func (gui *Gui) handleDiscardOldFileChange(g *gocui.Gui, v *gocui.View) error { fileName := gui.State.CommitFiles[gui.State.Panels.CommitFiles.SelectedLine].Name - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("DiscardFileChangesTitle"), @@ -167,7 +167,7 @@ func (gui *Gui) handleToggleFileForPatch(g *gocui.Gui, v *gocui.View) error { } if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("DiscardPatch"), @@ -231,7 +231,7 @@ func (gui *Gui) enterCommitFile(selectedLineIdx int) error { } if gui.GitCommand.PatchManager.CommitSelected() && gui.GitCommand.PatchManager.CommitSha != commitFile.Sha { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getCommitFilesView(), returnFocusOnClose: false, title: gui.Tr.SLocalize("DiscardPatch"), diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 2c1beafc7..1f0b132f6 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -155,7 +155,7 @@ func (gui *Gui) handleCommitSquashDown(g *gocui.Gui, v *gocui.View) error { return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("Squash"), @@ -186,7 +186,7 @@ func (gui *Gui) handleCommitFixup(g *gocui.Gui, v *gocui.View) error { return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("Fixup"), @@ -216,7 +216,7 @@ func (gui *Gui) handleRenameCommit(g *gocui.Gui, v *gocui.View) error { if gui.State.Panels.Commits.SelectedLine != 0 { return gui.createErrorPanel(gui.Tr.SLocalize("OnlyRenameTopCommit")) } - return gui.createPromptPanel(v, gui.Tr.SLocalize("renameCommit"), "", func(response string) error { + return gui.prompt(v, gui.Tr.SLocalize("renameCommit"), "", func(response string) error { if err := gui.GitCommand.RenameCommit(response); err != nil { return gui.surfaceError(err) } @@ -288,7 +288,7 @@ func (gui *Gui) handleCommitDelete(g *gocui.Gui, v *gocui.View) error { return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("DeleteCommitTitle"), @@ -380,7 +380,7 @@ func (gui *Gui) handleCommitAmendTo(g *gocui.Gui, v *gocui.View) error { return err } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("AmendCommitTitle"), @@ -498,7 +498,7 @@ func (gui *Gui) HandlePasteCommits(g *gocui.Gui, v *gocui.View) error { return err } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("CherryPick"), @@ -543,7 +543,7 @@ func (gui *Gui) handleCreateFixupCommit(g *gocui.Gui, v *gocui.View) error { return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("CreateFixupCommit"), @@ -573,7 +573,7 @@ func (gui *Gui) handleSquashAllAboveFixupCommits(g *gocui.Gui, v *gocui.View) er return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("SquashAboveCommits"), @@ -605,7 +605,7 @@ func (gui *Gui) handleTagCommit(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleCreateLightweightTag(commitSha string) error { - return gui.createPromptPanel(gui.getCommitsView(), gui.Tr.SLocalize("TagNameTitle"), "", func(response string) error { + return gui.prompt(gui.getCommitsView(), gui.Tr.SLocalize("TagNameTitle"), "", func(response string) error { if err := gui.GitCommand.CreateLightweightTag(response, commitSha); err != nil { return gui.surfaceError(err) } @@ -619,7 +619,7 @@ func (gui *Gui) handleCheckoutCommit(g *gocui.Gui, v *gocui.View) error { return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getCommitsView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("checkoutCommit"), diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 40fbca36d..15c615bb5 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -27,7 +27,7 @@ type createPopupPanelOpts struct { handleClose func() error } -type createConfirmationPanelOpts struct { +type askOpts struct { returnToView *gocui.View returnFocusOnClose bool title string @@ -45,7 +45,7 @@ func (gui *Gui) createLoaderPanel(currentView *gocui.View, prompt string) error }) } -func (gui *Gui) createConfirmationPanel(opts createConfirmationPanelOpts) error { +func (gui *Gui) ask(opts askOpts) error { return gui.createPopupPanel(createPopupPanelOpts{ returnToView: opts.returnToView, title: opts.title, @@ -56,7 +56,7 @@ func (gui *Gui) createConfirmationPanel(opts createConfirmationPanelOpts) error }) } -func (gui *Gui) createPromptPanel(currentView *gocui.View, title string, initialContent string, handleConfirm func(string) error) error { +func (gui *Gui) prompt(currentView *gocui.View, title string, initialContent string, handleConfirm func(string) error) error { return gui.createPopupPanel(createPopupPanelOpts{ returnToView: currentView, title: title, @@ -236,7 +236,7 @@ func (gui *Gui) createErrorPanel(message string) error { return err } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.g.CurrentView(), title: gui.Tr.SLocalize("Error"), prompt: coloredMessage, diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index 24c351b00..109d2d0de 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -150,7 +150,7 @@ func (gui *Gui) handleCreateDiffingMenuPanel(g *gocui.Gui, v *gocui.View) error { displayString: gui.Tr.SLocalize("enterRefToDiff"), onPress: func() error { - return gui.createPromptPanel(v, gui.Tr.SLocalize("enteRefName"), "", func(response string) error { + return gui.prompt(v, gui.Tr.SLocalize("enteRefName"), "", func(response string) error { gui.State.Diff.Ref = strings.TrimSpace(response) return gui.refreshSidePanels(refreshOptions{mode: ASYNC}) }) diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 125a06651..be95627be 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -249,7 +249,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error { } if file.Tracked { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.g.CurrentView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("IgnoreTracked"), @@ -325,7 +325,7 @@ func (gui *Gui) handleCommitPress(g *gocui.Gui, filesView *gocui.View) error { } func (gui *Gui) promptToStageAllAndRetry(retry func() error) error { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getFilesView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("NoFilesStagedTitle"), @@ -354,7 +354,7 @@ func (gui *Gui) handleAmendCommitPress(g *gocui.Gui, filesView *gocui.View) erro return gui.createErrorPanel(gui.Tr.SLocalize("NoCommitToAmend")) } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: filesView, returnFocusOnClose: true, title: strings.Title(gui.Tr.SLocalize("AmendLastCommit")), @@ -461,7 +461,7 @@ func (gui *Gui) handlePullFiles(g *gocui.Gui, v *gocui.View) error { } } - return gui.createPromptPanel(v, gui.Tr.SLocalize("EnterUpstream"), "origin/"+currentBranch.Name, func(upstream string) error { + return gui.prompt(v, gui.Tr.SLocalize("EnterUpstream"), "origin/"+currentBranch.Name, func(upstream string) error { if err := gui.GitCommand.SetUpstreamBranch(upstream); err != nil { errorMessage := err.Error() if strings.Contains(errorMessage, "does not exist") { @@ -529,7 +529,7 @@ func (gui *Gui) pushWithForceFlag(g *gocui.Gui, v *gocui.View, force bool, upstr branchName := gui.getCheckedOutBranch().Name err := gui.GitCommand.Push(branchName, force, upstream, args, gui.promptUserForCredential) if err != nil && !force && strings.Contains(err.Error(), "Updates were rejected") { - gui.createConfirmationPanel(createConfirmationPanelOpts{ + gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("ForcePush"), @@ -566,7 +566,7 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error { if gui.GitCommand.PushToCurrent { return gui.pushWithForceFlag(g, v, false, "", "--set-upstream") } else { - return gui.createPromptPanel(v, gui.Tr.SLocalize("EnterUpstream"), "origin "+currentBranch.Name, func(response string) error { + return gui.prompt(v, gui.Tr.SLocalize("EnterUpstream"), "origin "+currentBranch.Name, func(response string) error { return gui.pushWithForceFlag(g, v, false, response, "") }) } @@ -574,7 +574,7 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error { return gui.pushWithForceFlag(g, v, false, "", "") } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("ForcePush"), @@ -620,7 +620,7 @@ func (gui *Gui) anyFilesWithMergeConflicts() bool { } func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error { - return gui.createPromptPanel(v, gui.Tr.SLocalize("CustomCommand"), "", func(command string) error { + return gui.prompt(v, gui.Tr.SLocalize("CustomCommand"), "", func(command string) error { gui.SubProcess = gui.OSCommand.RunCustomCommand(command) return gui.Errors.ErrSubProcess }) diff --git a/pkg/gui/filtering.go b/pkg/gui/filtering.go index 3acb3c34a..efca602f3 100644 --- a/pkg/gui/filtering.go +++ b/pkg/gui/filtering.go @@ -6,7 +6,7 @@ func (gui *Gui) inFilterMode() bool { func (gui *Gui) validateNotInFilterMode() (bool, error) { if gui.inFilterMode() { - err := gui.createConfirmationPanel(createConfirmationPanelOpts{ + err := gui.ask(askOpts{ returnToView: gui.g.CurrentView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("MustExitFilterModeTitle"), diff --git a/pkg/gui/filtering_menu_panel.go b/pkg/gui/filtering_menu_panel.go index dcd2be5fd..526313345 100644 --- a/pkg/gui/filtering_menu_panel.go +++ b/pkg/gui/filtering_menu_panel.go @@ -41,7 +41,7 @@ func (gui *Gui) handleCreateFilteringMenuPanel(g *gocui.Gui, v *gocui.View) erro menuItems = append(menuItems, &menuItem{ displayString: gui.Tr.SLocalize("filterPathOption"), onPress: func() error { - return gui.createPromptPanel(v, gui.Tr.SLocalize("enterFileName"), "", func(response string) error { + return gui.prompt(v, gui.Tr.SLocalize("enterFileName"), "", func(response string) error { gui.State.FilterPath = strings.TrimSpace(response) return gui.Errors.ErrRestart }) diff --git a/pkg/gui/git_flow.go b/pkg/gui/git_flow.go index cddc0ae9d..367dd3048 100644 --- a/pkg/gui/git_flow.go +++ b/pkg/gui/git_flow.go @@ -51,7 +51,7 @@ func (gui *Gui) handleCreateGitFlowMenu(g *gocui.Gui, v *gocui.View) error { startHandler := func(branchType string) func() error { return func() error { title := gui.Tr.TemplateLocalize("NewBranchNamePrompt", map[string]interface{}{"branchType": branchType}) - return gui.createPromptPanel(gui.getMenuView(), title, "", func(name string) error { + return gui.prompt(gui.getMenuView(), title, "", func(name string) error { subProcess := gui.OSCommand.PrepareSubProcess("git", "flow", branchType, "start", name) gui.SubProcess = subProcess return gui.Errors.ErrSubProcess diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index ec582e131..0adc03395 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -468,7 +468,7 @@ func (gui *Gui) showShamelessSelfPromotionMessage(done chan struct{}) error { return gui.Config.WriteToUserConfig("startupPopupVersion", StartupPopupVersion) } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: nil, returnFocusOnClose: true, title: gui.Tr.SLocalize("ShamelessSelfPromotionTitle"), @@ -479,7 +479,7 @@ func (gui *Gui) showShamelessSelfPromotionMessage(done chan struct{}) error { } func (gui *Gui) promptAnonymousReporting(done chan struct{}) error { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: nil, returnFocusOnClose: true, title: gui.Tr.SLocalize("AnonymousReportingTitle"), @@ -518,7 +518,7 @@ func (gui *Gui) startBackgroundFetch() { } err := gui.fetch(false) if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew { - _ = gui.createConfirmationPanel(createConfirmationPanelOpts{ + _ = gui.ask(askOpts{ returnToView: gui.g.CurrentView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("NoAutomaticGitFetchTitle"), diff --git a/pkg/gui/merge_panel.go b/pkg/gui/merge_panel.go index 5918b9476..c40daab65 100644 --- a/pkg/gui/merge_panel.go +++ b/pkg/gui/merge_panel.go @@ -336,7 +336,7 @@ func (gui *Gui) handleCompleteMerge() error { func (gui *Gui) promptToContinue() error { gui.takeOverScrolling() - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getFilesView(), returnFocusOnClose: true, title: "continue", diff --git a/pkg/gui/patch_options_panel.go b/pkg/gui/patch_options_panel.go index 5407e7c31..6f71c21c4 100644 --- a/pkg/gui/patch_options_panel.go +++ b/pkg/gui/patch_options_panel.go @@ -133,7 +133,7 @@ func (gui *Gui) handlePullPatchIntoWorkingTree() error { } if len(gui.trackedFiles()) > 0 { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.g.CurrentView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("MustStashTitle"), diff --git a/pkg/gui/quitting.go b/pkg/gui/quitting.go index 915babcca..6514c0f8e 100644 --- a/pkg/gui/quitting.go +++ b/pkg/gui/quitting.go @@ -55,7 +55,7 @@ func (gui *Gui) quit(v *gocui.View) error { } if gui.Config.GetUserConfig().GetBool("confirmOnQuit") { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: "", diff --git a/pkg/gui/rebase_options_panel.go b/pkg/gui/rebase_options_panel.go index ae0db7d0f..4f95e2704 100644 --- a/pkg/gui/rebase_options_panel.go +++ b/pkg/gui/rebase_options_panel.go @@ -78,7 +78,7 @@ func (gui *Gui) handleGenericMergeCommandResult(result error) error { // assume in this case that we're already done return nil } else if strings.Contains(result.Error(), "When you have resolved this problem") || strings.Contains(result.Error(), "fix conflicts") || strings.Contains(result.Error(), "Resolve all conflicts manually") { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getFilesView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("FoundConflictsTitle"), diff --git a/pkg/gui/reflog_panel.go b/pkg/gui/reflog_panel.go index b985f0faa..0077502b3 100644 --- a/pkg/gui/reflog_panel.go +++ b/pkg/gui/reflog_panel.go @@ -121,7 +121,7 @@ func (gui *Gui) handleCheckoutReflogCommit(g *gocui.Gui, v *gocui.View) error { return nil } - err := gui.createConfirmationPanel(createConfirmationPanelOpts{ + err := gui.ask(askOpts{ returnToView: gui.getCommitsView(), returnFocusOnClose: true, title: gui.Tr.SLocalize("checkoutCommit"), diff --git a/pkg/gui/remote_branches_panel.go b/pkg/gui/remote_branches_panel.go index be0092359..bc84acd21 100644 --- a/pkg/gui/remote_branches_panel.go +++ b/pkg/gui/remote_branches_panel.go @@ -95,7 +95,7 @@ func (gui *Gui) handleDeleteRemoteBranch(g *gocui.Gui, v *gocui.View) error { } message := fmt.Sprintf("%s '%s'?", gui.Tr.SLocalize("DeleteRemoteBranchMessage"), remoteBranch.FullName()) - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("DeleteRemoteBranch"), @@ -129,7 +129,7 @@ func (gui *Gui) handleSetBranchUpstream(g *gocui.Gui, v *gocui.View) error { }, ) - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("SetUpstreamTitle"), @@ -164,7 +164,7 @@ func (gui *Gui) handleNewBranchOffRemote(g *gocui.Gui, v *gocui.View) error { "branchName": branch.FullName(), }, ) - return gui.createPromptPanel(v, message, branch.FullName(), func(response string) error { + return gui.prompt(v, message, branch.FullName(), func(response string) error { if err := gui.GitCommand.NewBranch(response, branch.FullName()); err != nil { return gui.surfaceError(err) } diff --git a/pkg/gui/remotes_panel.go b/pkg/gui/remotes_panel.go index 3957adc10..9de7d56e8 100644 --- a/pkg/gui/remotes_panel.go +++ b/pkg/gui/remotes_panel.go @@ -116,8 +116,8 @@ func (gui *Gui) handleRemoteEnter(g *gocui.Gui, v *gocui.View) error { func (gui *Gui) handleAddRemote(g *gocui.Gui, v *gocui.View) error { branchesView := gui.getBranchesView() - return gui.createPromptPanel(branchesView, gui.Tr.SLocalize("newRemoteName"), "", func(remoteName string) error { - return gui.createPromptPanel(branchesView, gui.Tr.SLocalize("newRemoteUrl"), "", func(remoteUrl string) error { + return gui.prompt(branchesView, gui.Tr.SLocalize("newRemoteName"), "", func(remoteName string) error { + return gui.prompt(branchesView, gui.Tr.SLocalize("newRemoteUrl"), "", func(remoteUrl string) error { if err := gui.GitCommand.AddRemote(remoteName, remoteUrl); err != nil { return err } @@ -132,7 +132,7 @@ func (gui *Gui) handleRemoveRemote(g *gocui.Gui, v *gocui.View) error { return nil } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("removeRemote"), @@ -161,7 +161,7 @@ func (gui *Gui) handleEditRemote(g *gocui.Gui, v *gocui.View) error { }, ) - return gui.createPromptPanel(branchesView, editNameMessage, "", func(updatedRemoteName string) error { + return gui.prompt(branchesView, editNameMessage, "", func(updatedRemoteName string) error { if updatedRemoteName != remote.Name { if err := gui.GitCommand.RenameRemote(remote.Name, updatedRemoteName); err != nil { return gui.surfaceError(err) @@ -175,7 +175,7 @@ func (gui *Gui) handleEditRemote(g *gocui.Gui, v *gocui.View) error { }, ) - return gui.createPromptPanel(branchesView, editUrlMessage, "", func(updatedRemoteUrl string) error { + return gui.prompt(branchesView, editUrlMessage, "", func(updatedRemoteUrl string) error { if err := gui.GitCommand.UpdateRemoteUrl(updatedRemoteName, updatedRemoteUrl); err != nil { return gui.surfaceError(err) } diff --git a/pkg/gui/staging_panel.go b/pkg/gui/staging_panel.go index 92e3868d4..7d8a1e088 100644 --- a/pkg/gui/staging_panel.go +++ b/pkg/gui/staging_panel.go @@ -114,7 +114,7 @@ func (gui *Gui) handleResetSelection(g *gocui.Gui, v *gocui.View) error { } if !gui.Config.GetUserConfig().GetBool("gui.skipUnstageLineWarning") { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: gui.getMainView(), returnFocusOnClose: false, title: gui.Tr.SLocalize("UnstageLinesTitle"), diff --git a/pkg/gui/stash_panel.go b/pkg/gui/stash_panel.go index 6979591ab..38dc5a92c 100644 --- a/pkg/gui/stash_panel.go +++ b/pkg/gui/stash_panel.go @@ -76,7 +76,7 @@ func (gui *Gui) handleStashApply(g *gocui.Gui, v *gocui.View) error { return apply() } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("StashApply"), @@ -98,7 +98,7 @@ func (gui *Gui) handleStashPop(g *gocui.Gui, v *gocui.View) error { return pop() } - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("StashPop"), @@ -110,7 +110,7 @@ func (gui *Gui) handleStashPop(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleStashDrop(g *gocui.Gui, v *gocui.View) error { - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("StashDrop"), @@ -142,7 +142,7 @@ func (gui *Gui) handleStashSave(stashFunc func(message string) error) error { if len(gui.trackedFiles()) == 0 && len(gui.stagedFiles()) == 0 { return gui.createErrorPanel(gui.Tr.SLocalize("NoTrackedStagedFilesStash")) } - return gui.createPromptPanel(gui.getFilesView(), gui.Tr.SLocalize("StashChanges"), "", func(stashComment string) error { + return gui.prompt(gui.getFilesView(), gui.Tr.SLocalize("StashChanges"), "", func(stashComment string) error { if err := stashFunc(stashComment); err != nil { return gui.surfaceError(err) } diff --git a/pkg/gui/tags_panel.go b/pkg/gui/tags_panel.go index 7dc8f3e65..44e6c1246 100644 --- a/pkg/gui/tags_panel.go +++ b/pkg/gui/tags_panel.go @@ -104,7 +104,7 @@ func (gui *Gui) handleDeleteTag(g *gocui.Gui, v *gocui.View) error { }, ) - return gui.createConfirmationPanel(createConfirmationPanelOpts{ + return gui.ask(askOpts{ returnToView: v, returnFocusOnClose: true, title: gui.Tr.SLocalize("DeleteTagTitle"), @@ -131,7 +131,7 @@ func (gui *Gui) handlePushTag(g *gocui.Gui, v *gocui.View) error { }, ) - return gui.createPromptPanel(v, title, "origin", func(response string) error { + return gui.prompt(v, title, "origin", func(response string) error { if err := gui.GitCommand.PushTag(response, tag.Name); err != nil { return gui.surfaceError(err) } @@ -140,7 +140,7 @@ func (gui *Gui) handlePushTag(g *gocui.Gui, v *gocui.View) error { } func (gui *Gui) handleCreateTag(g *gocui.Gui, v *gocui.View) error { - return gui.createPromptPanel(v, gui.Tr.SLocalize("CreateTagTitle"), "", func(tagName string) error { + return gui.prompt(v, gui.Tr.SLocalize("CreateTagTitle"), "", |