diff options
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 931 |
1 files changed, 416 insertions, 515 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 4b66281fc..25433eca5 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -194,593 +194,500 @@ func (gui *Gui) noPopupPanel(f func() error) func() error { } } -func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) { - config := gui.c.UserConfig.Keybinding +// renaming receiver to 'self' to aid refactoring. Will probably end up moving all Gui handlers to this pattern eventually. +func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) { + config := self.c.UserConfig.Keybinding guards := types.KeybindingGuards{ - OutsideFilterMode: gui.outsideFilterMode, - NoPopupPanel: gui.noPopupPanel, + OutsideFilterMode: self.outsideFilterMode, + NoPopupPanel: self.noPopupPanel, + } + + opts := types.KeybindingsOpts{ + GetKey: self.getKey, + Config: config, + Guards: guards, } bindings := []*types.Binding{ { ViewName: "", - Key: gui.getKey(config.Universal.Quit), + Key: opts.GetKey(opts.Config.Universal.Quit), Modifier: gocui.ModNone, - Handler: gui.handleQuit, + Handler: self.handleQuit, }, { ViewName: "", - Key: gui.getKey(config.Universal.QuitWithoutChangingDirectory), + Key: opts.GetKey(opts.Config.Universal.QuitWithoutChangingDirectory), Modifier: gocui.ModNone, - Handler: gui.handleQuitWithoutChangingDirectory, + Handler: self.handleQuitWithoutChangingDirectory, }, { ViewName: "", - Key: gui.getKey(config.Universal.QuitAlt1), + Key: opts.GetKey(opts.Config.Universal.QuitAlt1), Modifier: gocui.ModNone, - Handler: gui.handleQuit, + Handler: self.handleQuit, }, { ViewName: "", - Key: gui.getKey(config.Universal.Return), + Key: opts.GetKey(opts.Config.Universal.Return), Modifier: gocui.ModNone, - Handler: gui.handleTopLevelReturn, + Handler: self.handleTopLevelReturn, }, { ViewName: "", - Key: gui.getKey(config.Universal.OpenRecentRepos), - Handler: gui.handleCreateRecentReposMenu, + Key: opts.GetKey(opts.Config.Universal.OpenRecentRepos), + Handler: self.handleCreateRecentReposMenu, Alternative: "<c-r>", - Description: gui.c.Tr.SwitchRepo, + Description: self.c.Tr.SwitchRepo, }, { ViewName: "", - Key: gui.getKey(config.Universal.ScrollUpMain), - Handler: gui.scrollUpMain, + Key: opts.GetKey(opts.Config.Universal.ScrollUpMain), + Handler: self.scrollUpMain, Alternative: "fn+up", - Description: gui.c.Tr.LcScrollUpMainPanel, + Description: self.c.Tr.LcScrollUpMainPanel, }, { ViewName: "", - Key: gui.getKey(config.Universal.ScrollDownMain), - Handler: gui.scrollDownMain, + Key: opts.GetKey(opts.Config.Universal.ScrollDownMain), + Handler: self.scrollDownMain, Alternative: "fn+down", - Description: gui.c.Tr.LcScrollDownMainPanel, + Description: self.c.Tr.LcScrollDownMainPanel, }, { ViewName: "", - Key: gui.getKey(config.Universal.ScrollUpMainAlt1), + Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt1), Modifier: gocui.ModNone, - Handler: gui.scrollUpMain, + Handler: self.scrollUpMain, }, { ViewName: "", - Key: gui.getKey(config.Universal.ScrollDownMainAlt1), + Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt1), Modifier: gocui.ModNone, - Handler: gui.scrollDownMain, + Handler: self.scrollDownMain, }, { ViewName: "", - Key: gui.getKey(config.Universal.ScrollUpMainAlt2), + Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt2), Modifier: gocui.ModNone, - Handler: gui.scrollUpMain, + Handler: self.scrollUpMain, }, { ViewName: "", - Key: gui.getKey(config.Universal.ScrollDownMainAlt2), + Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt2), Modifier: gocui.ModNone, - Handler: gui.scrollDownMain, + Handler: self.scrollDownMain, }, { ViewName: "", - Key: gui.getKey(config.Universal.CreateRebaseOptionsMenu), - Handler: gui.helpers.Rebase.CreateRebaseOptionsMenu, - Description: gui.c.Tr.ViewMergeRebaseOptions, + Key: opts.GetKey(opts.Config.Universal.CreateRebaseOptionsMenu), + Handler: self.helpers.MergeAndRebase.CreateRebaseOptionsMenu, + Description: self.c.Tr.ViewMergeRebaseOptions, OpensMenu: true, }, { ViewName: "", - Key: gui.getKey(config.Universal.CreatePatchOptionsMenu), - Handler: gui.handleCreatePatchOptionsMenu, - Description: gui.c.Tr.ViewPatchOptions, + Key: opts.GetKey(opts.Config.Universal.CreatePatchOptionsMenu), + Handler: self.handleCreatePatchOptionsMenu, + Description: self.c.Tr.ViewPatchOptions, OpensMenu: true, }, { ViewName: "", - Key: gui.getKey(config.Universal.Refresh), - Handler: gui.handleRefresh, - Description: gui.c.Tr.LcRefresh, + Key: opts.GetKey(opts.Config.Universal.Refresh), + Handler: self.handleRefresh, + Description: self.c.Tr.LcRefresh, }, { ViewName: "", - Key: gui.getKey(config.Universal.OptionMenu), - Handler: gui.handleCreateOptionsMenu, - Description: gui.c.Tr.LcOpenMenu, + Key: opts.GetKey(opts.Config.Universal.OptionMenu), + Handler: self.handleCreateOptionsMenu, + Description: self.c.Tr.LcOpenMenu, OpensMenu: true, }, { ViewName: "", - Key: gui.getKey(config.Universal.OptionMenuAlt1), + Key: opts.GetKey(opts.Config.Universal.OptionMenuAlt1), Modifier: gocui.ModNone, - Handler: gui.handleCreateOptionsMenu, + Handler: self.handleCreateOptionsMenu, }, { ViewName: "status", - Key: gui.getKey(config.Universal.Edit), - Handler: gui.handleEditConfig, - Description: gui.c.Tr.EditConfig, + Key: opts.GetKey(opts.Config.Universal.Edit), + Handler: self.handleEditConfig, + Description: self.c.Tr.EditConfig, }, { ViewName: "", - Key: gui.getKey(config.Universal.NextScreenMode), - Handler: gui.nextScreenMode, - Description: gui.c.Tr.LcNextScreenMode, + Key: opts.GetKey(opts.Config.Universal.NextScreenMode), + Handler: self.nextScreenMode, + Description: self.c.Tr.LcNextScreenMode, }, { ViewName: "", - Key: gui.getKey(config.Universal.PrevScreenMode), - Handler: gui.prevScreenMode, - Description: gui.c.Tr.LcPrevScreenMode, + Key: opts.GetKey(opts.Config.Universal.PrevScreenMode), + Handler: self.prevScreenMode, + Description: self.c.Tr.LcPrevScreenMode, }, { ViewName: "status", - Key: gui.getKey(config.Universal.OpenFile), - Handler: gui.handleOpenConfig, - Description: gui.c.Tr.OpenConfig, + Key: opts.GetKey(opts.Config.Universal.OpenFile), + Handler: self.handleOpenConfig, + Description: self.c.Tr.OpenConfig, }, { ViewName: "status", - Key: gui.getKey(config.Status.CheckForUpdate), - Handler: gui.handleCheckForUpdate, - Description: gui.c.Tr.LcCheckForUpdate, + Key: opts.GetKey(opts.Config.Status.CheckForUpdate), + Handler: self.handleCheckForUpdate, + Description: self.c.Tr.LcCheckForUpdate, }, { ViewName: "status", - Key: gui.getKey(config.Status.RecentRepos), - Handler: gui.handleCreateRecentReposMenu, - Description: gui.c.Tr.SwitchRepo, + Key: opts.GetKey(opts.Config.Status.RecentRepos), + Handler: self.handleCreateRecentReposMenu, + Description: self.c.Tr.SwitchRepo, }, { ViewName: "status", - Key: gui.getKey(config.Status.AllBranchesLogGraph), - Handler: gui.handleShowAllBranchLogs, - Description: gui.c.Tr.LcAllBranchesLogGraph, + Key: opts.GetKey(opts.Config.Status.AllBranchesLogGraph), + Handler: self.handleShowAllBranchLogs, + Description: self.c.Tr.LcAllBranchesLogGraph, }, { ViewName: "files", Contexts: []string{string(context.FILES_CONTEXT_KEY)}, - Key: gui.getKey(config.Files.ViewResetOptions), - Handler: gui.handleCreateResetMenu, - Description: gui.c.Tr.LcViewResetOptions, + Key: opts.GetKey(opts.Config.Files.ViewResetOptions), + Handler: self.handleCreateResetMenu, + Description: self.c.Tr.LcViewResetOptions, OpensMenu: true, }, { ViewName: "files", Contexts: []string{string(context.FILES_CONTEXT_KEY)}, - Key: gui.getKey(config.Files.Fetch), - Handler: gui.handleGitFetch, - Description: gui.c.Tr.LcFetch, - }, - { - ViewName: "files", - Contexts: []string{string(context.FILES_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.CopyToClipboard), - Handler: gui.handleCopySelectedSideContextItemToClipboard, - Description: gui.c.Tr.LcCopyFileNameToClipboard, + Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), + Handler: self.handleCopySelectedSideContextItemToClipboard, + Description: self.c.Tr.LcCopyFileNameToClipboard, }, { ViewName: "branches", Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Select), - Handler: gui.handleBranchPress, - Description: gui.c.Tr.LcCheckout, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.CreatePullRequest), - Handler: gui.handleCreatePullRequestPress, - Description: gui.c.Tr.LcCreatePullRequest, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.ViewPullRequestOptions), - Handler: gui.handleCreatePullRequestMenu, - Description: gui.c.Tr.LcCreatePullRequestOptions, + Key: opts.GetKey(opts.Config.Branches.ViewGitFlowOptions), + Handler: self.handleCreateGitFlowMenu, + Description: self.c.Tr.LcGitFlowOptions, OpensMenu: true, }, { ViewName: "branches", Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.CopyPullRequestURL), - Handler: gui.handleCopyPullRequestURLPress, - Description: gui.c.Tr.LcCopyPullRequestURL, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.CheckoutBranchByName), - Handler: gui.handleCheckoutByName, - Description: gui.c.Tr.LcCheckoutByName, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.ForceCheckoutBranch), - Handler: gui.handleForceCheckout, - Description: gui.c.Tr.LcForceCheckout, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.New), - Handler: gui.handleNewBranchOffBranch, - Description: gui.c.Tr.LcNewBranch, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Remove), - Handler: gui.handleDeleteBranch, - Description: gui.c.Tr.LcDeleteBranch, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.RebaseBranch), - Handler: guards.OutsideFilterMode(gui.handleRebaseOntoLocalBranch), - Description: gui.c.Tr.LcRebaseBranch, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.MergeIntoCurrentBranch), - Handler: guards.OutsideFilterMode(gui.handleMerge), - Description: gui.c.Tr.LcMergeIntoCurrentBranch, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.ViewGitFlowOptions), - Handler: gui.handleCreateGitFlowMenu, - Description: gui.c.Tr.LcGitFlowOptions, - OpensMenu: true, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.FastForward), - Handler: gui.handleFastForward, - Description: gui.c.Tr.FastForward, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ViewResetOptions), - Handler: gui.handleCreateResetToBranchMenu, - Description: gui.c.Tr.LcViewResetOptions, - OpensMenu: true, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Branches.RenameBranch), - Handler: gui.handleRenameBranch, - Description: gui.c.Tr.LcRenameBranch, - }, - { - ViewName: "branches", - Contexts: []string{string(context.LOCAL_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.CopyToClipboard), - Handler: gui.handleCopySelectedSideContextItemToClipboard, - Description: gui.c.Tr.LcCopyBranchNameToClipboard, + Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), + Handler: self.handleCopySelectedSideContextItemToClipboard, + Description: self.c.Tr.LcCopyBranchNameToClipboard, }, { ViewName: "branches", Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Return), - Handler: gui.handleRemoteBranchesEscape, - Description: gui.c.Tr.ReturnToRemotesList, + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.handleRemoteBranchesEscape, + Description: self.c.Tr.ReturnToRemotesList, }, { ViewName: "branches", Contexts: []string{string(context.REMOTE_BRANCHES_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ViewResetOptions), - Handler: gui.handleCreateResetToRemoteBranchMenu, - Description: gui.c.Tr.LcViewResetOptions, + Key: opts.GetKey(opts.Config.Commits.ViewResetOptions), + Handler: self.handleCreateResetToRemoteBranchMenu, + Description: self.c.Tr.LcViewResetOptions, OpensMenu: true, }, { ViewName: "commits", Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.CopyToClipboard), - Handler: gui.handleCopySelectedSideContextItemToClipboard, - Description: gui.c.Tr.LcCopyCommitShaToClipboard, + Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), + Handler: self.handleCopySelectedSideContextItemToClipboard, + Description: self.c.Tr.LcCopyCommitShaToClipboard, }, { ViewName: "commits", Contexts: []string{string(context.BRANCH_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ResetCherryPick), - Handler: gui.helpers.CherryPick.Reset, - Description: gui.c.Tr.LcResetCherryPick, + Key: opts.GetKey(opts.Config.Commits.ResetCherryPick), + Handler: self.helpers.CherryPick.Reset, + Description: self.c.Tr.LcResetCherryPick, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.GoInto), - Handler: gui.handleViewReflogCommitFiles, - Description: gui.c.Tr.LcViewCommitFiles, + Key: opts.GetKey(opts.Config.Universal.GoInto), + Handler: self.handleViewReflogCommitFiles, + Description: self.c.Tr.LcViewCommitFiles, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Select), - Handler: gui.CheckoutReflogCommit, - Description: gui.c.Tr.LcCheckoutCommit, + Key: opts.GetKey(opts.Config.Universal.Select), + Handler: self.CheckoutReflogCommit, + Description: self.c.Tr.LcCheckoutCommit, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ViewResetOptions), - Handler: gui.handleCreateReflogResetMenu, - Description: gui.c.Tr.LcViewResetOptions, + Key: opts.GetKey(opts.Config.Commits.ViewResetOptions), + Handler: self.handleCreateReflogResetMenu, + Description: self.c.Tr.LcViewResetOptions, OpensMenu: true, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.CherryPickCopy), - Handler: guards.OutsideFilterMode(gui.handleCopyReflogCommit), - Description: gui.c.Tr.LcCherryPickCopy, + Key: opts.GetKey(opts.Config.Commits.CherryPickCopy), + Handler: opts.Guards.OutsideFilterMode(self.handleCopyReflogCommit), + Description: self.c.Tr.LcCherryPickCopy, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.CherryPickCopyRange), - Handler: guards.OutsideFilterMode(gui.handleCopyReflogCommitRange), - Description: gui.c.Tr.LcCherryPickCopyRange, + Key: opts.GetKey(opts.Config.Commits.CherryPickCopyRange), + Handler: opts.Guards.OutsideFilterMode(self.handleCopyReflogCommitRange), + Description: self.c.Tr.LcCherryPickCopyRange, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ResetCherryPick), - Handler: gui.helpers.CherryPick.Reset, - Description: gui.c.Tr.LcResetCherryPick, + Key: opts.GetKey(opts.Config.Commits.ResetCherryPick), + Handler: self.helpers.CherryPick.Reset, + Description: self.c.Tr.LcResetCherryPick, }, { ViewName: "commits", Contexts: []string{string(context.REFLOG_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.CopyToClipboard), - Handler: gui.handleCopySelectedSideContextItemToClipboard, - Description: gui.c.Tr.LcCopyCommitShaToClipboard, + Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), + Handler: self.handleCopySelectedSideContextItemToClipboard, + Description: self.c.Tr.LcCopyCommitShaToClipboard, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.GoInto), - Handler: gui.handleViewSubCommitFiles, - Description: gui.c.Tr.LcViewCommitFiles, + Key: opts.GetKey(opts.Config.Universal.GoInto), + Handler: self.handleViewSubCommitFiles, + Description: self.c.Tr.LcViewCommitFiles, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Select), - Handler: gui.handleCheckoutSubCommit, - Description: gui.c.Tr.LcCheckoutCommit, + Key: opts.GetKey(opts.Config.Universal.Select), + Handler: self.handleCheckoutSubCommit, + Description: self.c.Tr.LcCheckoutCommit, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ViewResetOptions), - Handler: gui.handleCreateSubCommitResetMenu, - Description: gui.c.Tr.LcViewResetOptions, + Key: opts.GetKey(opts.Config.Commits.ViewResetOptions), + Handler: self.handleCreateSubCommitResetMenu, + Description: self.c.Tr.LcViewResetOptions, OpensMenu: true, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.New), - Handler: gui.handleNewBranchOffSubCommit, - Description: gui.c.Tr.LcNewBranch, + Key: opts.GetKey(opts.Config.Universal.New), + Handler: self.handleNewBranchOffSubCommit, + Description: self.c.Tr.LcNewBranch, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.CherryPickCopy), - Handler: gui.handleCopySubCommit, - Description: gui.c.Tr.LcCherryPickCopy, + Key: opts.GetKey(opts.Config.Commits.CherryPickCopy), + Handler: self.handleCopySubCommit, + Description: self.c.Tr.LcCherryPickCopy, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.CherryPickCopyRange), - Handler: gui.handleCopySubCommitRange, - Description: gui.c.Tr.LcCherryPickCopyRange, + Key: opts.GetKey(opts.Config.Commits.CherryPickCopyRange), + Handler: self.handleCopySubCommitRange, + Description: self.c.Tr.LcCherryPickCopyRange, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Commits.ResetCherryPick), - Handler: gui.helpers.CherryPick.Reset, - Description: gui.c.Tr.LcResetCherryPick, + Key: opts.GetKey(opts.Config.Commits.ResetCherryPick), + Handler: self.helpers.CherryPick.Reset, + Description: self.c.Tr.LcResetCherryPick, }, { ViewName: "branches", Contexts: []string{string(context.SUB_COMMITS_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.CopyToClipboard), - Handler: gui.handleCopySelectedSideContextItemToClipboard, - Description: gui.c.Tr.LcCopyCommitShaToClipboard, + Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), + Handler: self.handleCopySelectedSideContextItemToClipboard, + Description: self.c.Tr.LcCopyCommitShaToClipboard, }, { ViewName: "stash", - Key: gui.getKey(config.Universal.GoInto), - Handler: gui.handleViewStashFiles, - Description: gui.c.Tr.LcViewStashFiles, + Key: opts.GetKey(opts.Config.Universal.GoInto), + Handler: self.handleViewStashFiles, + Description: self.c.Tr.LcViewStashFiles, }, { ViewName: "stash", - Key: gui.getKey(config.Universal.Select), - Handler: gui.handleStashApply, - Description: gui.c.Tr.LcApply, + Key: opts.GetKey(opts.Config.Universal.Select), + Handler: self.handleStashApply, + Description: self.c.Tr.LcApply, }, { ViewName: "stash", - Key: gui.getKey(config.Stash.PopStash), - Handler: gui.handleStashPop, - Description: gui.c.Tr.LcPop, + Key: opts.GetKey(opts.Config.Stash.PopStash), + Handler: self.handleStashPop, + Description: self.c.Tr.LcPop, }, { ViewName: "stash", - Key: gui.getKey(config.Universal.Remove), - Handler: gui.handleStashDrop, - Description: gui.c.Tr.LcDrop, + Key: opts.GetKey(opts.Config.Universal.Remove), + Handler: self.handleStashDrop, + Description: self.c.Tr.LcDrop, }, { ViewName: "stash", - Key: gui.getKey(config.Universal.New), - Handler: gui.handleNewBranchOffStashEntry, - Description: gui.c.Tr.LcNewBranch, + Key: opts.GetKey(opts.Config.Universal.New), + Handler: self.handleNewBranchOffStashEntry, + Description: self.c.Tr.LcNewBranch, }, { ViewName: "commitMessage", - Key: gui.getKey(config.Universal.SubmitEditorText), + Key: opts.GetKey(opts.Config.Universal.SubmitEditorText), Modifier: gocui.ModNone, - Handler: gui.handleCommitConfirm, + Handler: self.handleCommitConfirm, }, { ViewName: "commitMessage", - Key: gui.getKey(config.Universal.Return), + Key: opts.GetKey(opts.Config.Universal.Return), Modifier: gocui.ModNone, - Handler: gui.handleCommitClose, + Handler: self.handleCommitClose, }, { ViewName: "credentials", - Key: gui.getKey(config.Universal.Confirm), + Key: opts.GetKey(opts.Config.Universal.Confirm), Modifier: gocui.ModNone, - Handler: gui.handleSubmitCredential, + Handler: self.handleSubmitCredential, }, { ViewName: "credentials", - Key: gui.getKey(config.Universal.Return), + Key: opts.GetKey(opts.Config.Universal.Return), Modifier: gocui.ModNone, - Handler: gui.handleCloseCredentialsView, + Handler: self.handleCloseCredentialsView, }, { ViewName: "menu", - Key: gui.getKey(config.Universal.Return), - Handler: gui.handleMenuClose, - Description: gui.c.Tr.LcCloseMenu, + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.handleMenuClose, + Description: self.c.Tr.LcCloseMenu, }, { ViewName: "information", Key: gocui.MouseLeft, Modifier: gocui.ModNone, - Handler: gui.handleInfoClick, + Handler: self.handleInfoClick, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Universal.CopyToClipboard), - Handler: gui.handleCopySelectedSideContextItemToClipboard, - Description: gui.c.Tr.LcCopyCommitFileNameToClipboard, + Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), + Handler: self.handleCopySelectedSideContextItemToClipboard, + Description: self.c.Tr.LcCopyCommitFileNameToClipboard, }, { ViewName: "commitFiles", - Key: gui.getKey(config.CommitFiles.CheckoutCommitFile), - Handler: gui.handleCheckoutCommitFile, - Description: gui.c.Tr.LcCheckoutCommitFile, + Key: opts.GetKey(opts.Config.CommitFiles.CheckoutCommitFile), + Handler: self.handleCheckoutCommitFile, + Description: self.c.Tr.LcCheckoutCommitFile, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Universal.Remove), - Handler: gui.handleDiscardOldFileChange, - Description: gui.c.Tr.LcDiscardOldFileChange, + Key: opts.GetKey(opts.Config.Universal.Remove), + Handler: self.handleDiscardOldFileChange, + Description: self.c.Tr.LcDiscardOldFileChange, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Universal.OpenFile), - Handler: gui.handleOpenOldCommitFile, - Description: gui.c.Tr.LcOpenFile, + Key: opts.GetKey(opts.Config.Universal.OpenFile), + Handler: self.handleOpenOldCommitFile, + Description: self.c.Tr.LcOpenFile, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Universal.Edit), - Handler: gui.handleEditCommitFile, - Description: gui.c.Tr.LcEditFile, + Key: opts.GetKey(opts.Config.Universal.Edit), + Handler: self.handleEditCommitFile, + Description: self.c.Tr.LcEditFile, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Universal.Select), - Handler: gui.handleToggleFileForPatch, - Description: gui.c.Tr.LcToggleAddToPatch, + Key: opts.GetKey(opts.Config.Universal.Select), + Handler: self.handleToggleFileForPatch, + Description: self.c.Tr.LcToggleAddToPatch, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Universal.GoInto), - Handler: gui.handleEnterCommitFile, - Description: gui.c.Tr.LcEnterFile, + Key: opts.GetKey(opts.Config.Universal.GoInto), + Handler: self.handleEnterCommitFile, + Description: self.c.Tr.LcEnterFile, }, { ViewName: "commitFiles", - Key: gui.getKey(config.Files.ToggleTreeView), - Handler: gui.handleToggleCommitFileTreeView, - Description: gui.c.Tr.LcToggleTreeView, + Key: opts.GetKey(opts.Config.Files.ToggleTreeView), + Handler: self.handleToggleCommitFileTreeView, + Description: self.c.Tr.LcToggleTreeView, }, { ViewName: "", - Key: gui.getKey(config.Universal.FilteringMenu), - Handler: gui.handleCreateFilteringMenuPanel, - Description: gui.c.Tr.LcOpenFilteringMenu, + Key: opts.GetKey(opts.Config.Universal.FilteringMenu), + Handler: self.handleCreateFilteringMenuPanel, + Description: self.c.Tr.LcOpenFilteringMenu, OpensMenu: true, }, { ViewName: "", - Key: gui.getKey(config.Universal.DiffingMenu), - Handler: gui.handleCreateDiffingMenuPanel, - Description: gui.c.Tr.LcOpenDiffingMenu, + Key: opts.GetKey(opts.Config.Universal.DiffingMenu), + Handler: self.handleCreateDiffingMenuPanel, + Description: self.c.Tr.LcOpenDiffingMenu, OpensMenu: true, }, { ViewName: "", - Key: gui.getKey(config.Universal.DiffingMenuAlt), - Handler: gui.handleCreateDiffingMenuPanel, - Description: gui.c.Tr.LcOpenDiffingMenu, + Key: opts.GetKey(opts.Config.Universal.DiffingMenuAlt), + Handler: self.handleCreateDiffingMenuPanel, + Description: self.c.Tr.LcOpenDiffingMenu, OpensMenu: true, }, { ViewName: "", - Key: gui.getKey(config.Universal.ExtrasMenu), - Handler: gui.handleCreateExtrasMenuPanel, - Description: gui.c.Tr.LcOpenExtrasMenu, + Key: opts.GetKey(opts.Config.Universal.ExtrasMenu), + Handler: self.handleCreateExtrasMenuPanel, + Description: self.c.Tr.LcOpenExtrasMenu, OpensMenu: true, }, { ViewName: "secondary", Key: gocui.MouseWheelUp, Modifier: gocui.ModNone, - Handler: gui.scrollUpSecondary, + Handler: self.scrollUpSecondary, }, { ViewName: "secondary", Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, - Handler: gui.scrollDownSecondary, + Handler: self.scrollDownSecondary, }, { ViewName: "main", Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)}, Key: gocui.MouseWheelDown, - Handler: gui.scrollDownMain, - Description: gui.c.Tr.ScrollDown, + Handler: self.scrollDownMain, + Description: self.c.Tr.ScrollDown, Alternative: "fn+up", }, { ViewName: "main", Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)}, Key: gocui.MouseWheelUp, - Handler: gui.scrollUpMain, - Description: gui.c.Tr.ScrollUp, + Handler: self.scrollUpMain, + Description: self.c.Tr.ScrollUp, Alternative: "fn+down", }, { @@ -788,556 +695,550 @@ func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBin Contexts: []string{string(context.MAIN_NORMAL_CONTEXT_KEY)}, Key: gocui.MouseLeft, Modifier: gocui.ModNone, - Handler: gui.handleMouseDownMain, + Handler: self.handleMouseDownMain, }, { ViewName: "secondary", Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)}, Key: gocui.MouseLeft, Modifier: gocui.ModNone, - Handler: gui.handleTogglePanelClick, + Handler: self.handleTogglePanelClick, }, { ViewName: "main", Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Return), - Handler: gui.handleStagingEscape, - Description: gui.c.Tr.ReturnToFilesPanel, + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.handleStagingEscape, + Description: self.c.Tr.ReturnToFilesPanel, }, { ViewName: "main", Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Select), - Handler: gui.handleToggleStagedSelection, - Description: gui.c.Tr.StageSelection, + Key: opts.GetKey(opts.Config.Universal.Select), + Handler: self.handleToggleStagedSelection, + Description: self.c.Tr.StageSelection, }, { ViewName: "main", Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Remove), - Handler: gui.handleResetSelection, - Description: gui.c.Tr.ResetSelection, + Key: opts.GetKey(opts.Config.Universal.Remove), + Handler: self.handleResetSelection, + Description: self.c.Tr.ResetSelection, }, { ViewName: "main", Contexts: []string{string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.TogglePanel), - Handler: gui.handleTogglePanel, - Description: gui.c.Tr.TogglePanel, + Key: opts.GetKey(opts.Config.Universal.TogglePanel), + Handler: self.handleTogglePanel, + Description: self.c.Tr.TogglePanel, }, { ViewName: "main", Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.Return), - Handler: gui.handleEscapePatchBuildingPanel, - Description: gui.c.Tr.ExitLineByLineMode, + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.handleEscapePatchBuildingPanel, + Description: self.c.Tr.ExitLineByLineMode, }, { ViewName: "main", Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.OpenFile), - Handler: gui.handleOpenFileAtLine, - Description: gui.c.Tr.LcOpenFile, + Key: opts.GetKey(opts.Config.Universal.OpenFile), + Handler: self.handleOpenFileAtLine, + Description: self.c.Tr.LcOpenFile, }, { ViewName: "main", Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.PrevItem), - Handler: gui.handleSelectPrevLine, - Description: gui.c.Tr.PrevLine, + Key: opts.GetKey(opts.Config.Universal.PrevItem), + Handler: self.handleSelectPrevLine, + Description: self.c.Tr.PrevLine, }, { ViewName: "main", Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.NextItem), - Handler: gui.handleSelectNextLine, - Description: gui.c.Tr.NextLine, + Key: opts.GetKey(opts.Config.Universal.NextItem), + Handler: self.handleSelectNextLine, + Description: self.c.Tr.NextLine, }, { ViewName: "main", Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.PrevItemAlt), + Key: opts.GetKey(opts.Config.Universal.PrevItemAlt), Modifier: gocui.ModNone, - Handler: gui.handleSelectPrevLine, + Handler: self.handleSelectPrevLine, }, { ViewName: "main", Contexts: []string{string(context.MAIN_PATCH_BUILDING_CONTEXT_KEY), string(context.MAIN_STAGING_CONTEXT_KEY)}, - Key: gui.getKey(config.Universal.NextItemAlt), + Key: opts.GetKey(opts.Config.Universal.NextItemAlt), Modifier: gocui.ModNone, - Handler: gui.handleSelectNextLine, + Handler: self.handleSelectNextLine, }, { |