1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-03 00:57:52 +02:00

Fix warning ST1016: methods on the same type should have the same receiver name

Most methods use gui as a receiver name (120 of them), so switch the few that
use self over to that too.
This commit is contained in:
Stefan Haller
2025-06-20 19:49:46 +02:00
parent 7ebf5fff0f
commit 8c574f888c
2 changed files with 101 additions and 101 deletions

View File

@ -586,8 +586,8 @@ func (gui *Gui) resetState(startArgs appTypes.StartArgs) types.Context {
return initialContext(contextTree, startArgs) return initialContext(contextTree, startArgs)
} }
func (self *Gui) getViewBufferManagerForView(view *gocui.View) *tasks.ViewBufferManager { func (gui *Gui) getViewBufferManagerForView(view *gocui.View) *tasks.ViewBufferManager {
manager, ok := self.viewBufferManagerMap[view.Name()] manager, ok := gui.viewBufferManagerMap[view.Name()]
if !ok { if !ok {
return nil return nil
} }

View File

@ -45,27 +45,27 @@ func (gui *Gui) validateNotInFilterMode() bool {
} }
// only to be called from the cheatsheet generate script. This mutates the Gui struct. // only to be called from the cheatsheet generate script. This mutates the Gui struct.
func (self *Gui) GetCheatsheetKeybindings() []*types.Binding { func (gui *Gui) GetCheatsheetKeybindings() []*types.Binding {
self.g = &gocui.Gui{} gui.g = &gocui.Gui{}
if err := self.createAllViews(); err != nil { if err := gui.createAllViews(); err != nil {
panic(err) panic(err)
} }
// need to instantiate views // need to instantiate views
self.helpers = helpers.NewStubHelpers() gui.helpers = helpers.NewStubHelpers()
self.State = &GuiRepoState{} gui.State = &GuiRepoState{}
self.State.Contexts = self.contextTree() gui.State.Contexts = gui.contextTree()
self.State.ContextMgr = NewContextMgr(self, self.State.Contexts) gui.State.ContextMgr = NewContextMgr(gui, gui.State.Contexts)
self.resetHelpersAndControllers() gui.resetHelpersAndControllers()
bindings, _ := self.GetInitialKeybindings() bindings, _ := gui.GetInitialKeybindings()
return bindings return bindings
} }
func (self *Gui) keybindingOpts() types.KeybindingsOpts { func (gui *Gui) keybindingOpts() types.KeybindingsOpts {
config := self.c.UserConfig().Keybinding config := gui.c.UserConfig().Keybinding
guards := types.KeybindingGuards{ guards := types.KeybindingGuards{
OutsideFilterMode: self.outsideFilterMode, OutsideFilterMode: gui.outsideFilterMode,
NoPopupPanel: self.noPopupPanel, NoPopupPanel: gui.noPopupPanel,
} }
return types.KeybindingsOpts{ return types.KeybindingsOpts{
@ -76,318 +76,318 @@ func (self *Gui) keybindingOpts() types.KeybindingsOpts {
} }
// renaming receiver to 'self' to aid refactoring. Will probably end up moving all Gui handlers to this pattern eventually. // 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) { func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) {
opts := self.c.KeybindingsOpts() opts := gui.c.KeybindingsOpts()
bindings := []*types.Binding{ bindings := []*types.Binding{
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.OpenRecentRepos), Key: opts.GetKey(opts.Config.Universal.OpenRecentRepos),
Handler: opts.Guards.NoPopupPanel(self.helpers.Repos.CreateRecentReposMenu), Handler: opts.Guards.NoPopupPanel(gui.helpers.Repos.CreateRecentReposMenu),
Description: self.c.Tr.SwitchRepo, Description: gui.c.Tr.SwitchRepo,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollUpMain), Key: opts.GetKey(opts.Config.Universal.ScrollUpMain),
Handler: self.scrollUpMain, Handler: gui.scrollUpMain,
Alternative: "fn+up/shift+k", Alternative: "fn+up/shift+k",
Description: self.c.Tr.ScrollUpMainWindow, Description: gui.c.Tr.ScrollUpMainWindow,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollDownMain), Key: opts.GetKey(opts.Config.Universal.ScrollDownMain),
Handler: self.scrollDownMain, Handler: gui.scrollDownMain,
Alternative: "fn+down/shift+j", Alternative: "fn+down/shift+j",
Description: self.c.Tr.ScrollDownMainWindow, Description: gui.c.Tr.ScrollDownMainWindow,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt1), Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt1),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpMain, Handler: gui.scrollUpMain,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt1), Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt1),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownMain, Handler: gui.scrollDownMain,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt2), Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt2),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpMain, Handler: gui.scrollUpMain,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt2), Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt2),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownMain, Handler: gui.scrollDownMain,
}, },
{ {
ViewName: "files", ViewName: "files",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyPathToClipboard, Description: gui.c.Tr.CopyPathToClipboard,
}, },
{ {
ViewName: "localBranches", ViewName: "localBranches",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyBranchNameToClipboard, Description: gui.c.Tr.CopyBranchNameToClipboard,
}, },
{ {
ViewName: "remoteBranches", ViewName: "remoteBranches",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyBranchNameToClipboard, Description: gui.c.Tr.CopyBranchNameToClipboard,
}, },
{ {
ViewName: "tags", ViewName: "tags",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyTagToClipboard, Description: gui.c.Tr.CopyTagToClipboard,
}, },
{ {
ViewName: "commits", ViewName: "commits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard, Handler: gui.handleCopySelectedSideContextItemCommitHashToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyCommitHashToClipboard, Description: gui.c.Tr.CopyCommitHashToClipboard,
}, },
{ {
ViewName: "commits", ViewName: "commits",
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick), Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
Handler: self.helpers.CherryPick.Reset, Handler: gui.helpers.CherryPick.Reset,
Description: self.c.Tr.ResetCherryPick, Description: gui.c.Tr.ResetCherryPick,
}, },
{ {
ViewName: "reflogCommits", ViewName: "reflogCommits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyCommitHashToClipboard, Description: gui.c.Tr.CopyCommitHashToClipboard,
}, },
{ {
ViewName: "subCommits", ViewName: "subCommits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard, Handler: gui.handleCopySelectedSideContextItemCommitHashToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyCommitHashToClipboard, Description: gui.c.Tr.CopyCommitHashToClipboard,
}, },
{ {
ViewName: "information", ViewName: "information",
Key: gocui.MouseLeft, Key: gocui.MouseLeft,
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.handleInfoClick, Handler: gui.handleInfoClick,
}, },
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopyPathToClipboard, Description: gui.c.Tr.CopyPathToClipboard,
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ExtrasMenu), Key: opts.GetKey(opts.Config.Universal.ExtrasMenu),
Handler: opts.Guards.NoPopupPanel(self.handleCreateExtrasMenuPanel), Handler: opts.Guards.NoPopupPanel(gui.handleCreateExtrasMenuPanel),
Description: self.c.Tr.OpenCommandLogMenu, Description: gui.c.Tr.OpenCommandLogMenu,
Tooltip: self.c.Tr.OpenCommandLogMenuTooltip, Tooltip: gui.c.Tr.OpenCommandLogMenuTooltip,
OpensMenu: true, OpensMenu: true,
}, },
{ {
ViewName: "main", ViewName: "main",
Key: gocui.MouseWheelDown, Key: gocui.MouseWheelDown,
Handler: self.scrollDownMain, Handler: gui.scrollDownMain,
Description: self.c.Tr.ScrollDown, Description: gui.c.Tr.ScrollDown,
Alternative: "fn+up", Alternative: "fn+up",
}, },
{ {
ViewName: "main", ViewName: "main",
Key: gocui.MouseWheelUp, Key: gocui.MouseWheelUp,
Handler: self.scrollUpMain, Handler: gui.scrollUpMain,
Description: self.c.Tr.ScrollUp, Description: gui.c.Tr.ScrollUp,
Alternative: "fn+down", Alternative: "fn+down",
}, },
{ {
ViewName: "secondary", ViewName: "secondary",
Key: gocui.MouseWheelDown, Key: gocui.MouseWheelDown,
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownSecondary, Handler: gui.scrollDownSecondary,
}, },
{ {
ViewName: "secondary", ViewName: "secondary",
Key: gocui.MouseWheelUp, Key: gocui.MouseWheelUp,
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpSecondary, Handler: gui.scrollUpSecondary,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.PrevItem), Key: opts.GetKey(opts.Config.Universal.PrevItem),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpConfirmationPanel, Handler: gui.scrollUpConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.NextItem), Key: opts.GetKey(opts.Config.Universal.NextItem),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownConfirmationPanel, Handler: gui.scrollDownConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt), Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpConfirmationPanel, Handler: gui.scrollUpConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.NextItemAlt), Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownConfirmationPanel, Handler: gui.scrollDownConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: gocui.MouseWheelUp, Key: gocui.MouseWheelUp,
Handler: self.scrollUpConfirmationPanel, Handler: gui.scrollUpConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: gocui.MouseWheelDown, Key: gocui.MouseWheelDown,
Handler: self.scrollDownConfirmationPanel, Handler: gui.scrollDownConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.NextPage), Key: opts.GetKey(opts.Config.Universal.NextPage),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.pageDownConfirmationPanel, Handler: gui.pageDownConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.PrevPage), Key: opts.GetKey(opts.Config.Universal.PrevPage),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.pageUpConfirmationPanel, Handler: gui.pageUpConfirmationPanel,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoTop), Key: opts.GetKey(opts.Config.Universal.GotoTop),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToConfirmationPanelTop, Handler: gui.goToConfirmationPanelTop,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt), Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToConfirmationPanelTop, Handler: gui.goToConfirmationPanelTop,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoBottom), Key: opts.GetKey(opts.Config.Universal.GotoBottom),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToConfirmationPanelBottom, Handler: gui.goToConfirmationPanelBottom,
}, },
{ {
ViewName: "confirmation", ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt), Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToConfirmationPanelBottom, Handler: gui.goToConfirmationPanelBottom,
}, },
{ {
ViewName: "submodules", ViewName: "submodules",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard), Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopySelectedSideContextItemToClipboard, Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason, GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: self.c.Tr.CopySubmoduleNameToClipboard, Description: gui.c.Tr.CopySubmoduleNameToClipboard,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: gocui.MouseWheelUp, Key: gocui.MouseWheelUp,
Handler: self.scrollUpExtra, Handler: gui.scrollUpExtra,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: gocui.MouseWheelDown, Key: gocui.MouseWheelDown,
Handler: self.scrollDownExtra, Handler: gui.scrollDownExtra,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Tag: "navigation", Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt), Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpExtra, Handler: gui.scrollUpExtra,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Tag: "navigation", Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevItem), Key: opts.GetKey(opts.Config.Universal.PrevItem),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollUpExtra, Handler: gui.scrollUpExtra,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Tag: "navigation", Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextItem), Key: opts.GetKey(opts.Config.Universal.NextItem),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownExtra, Handler: gui.scrollDownExtra,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Tag: "navigation", Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextItemAlt), Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.scrollDownExtra, Handler: gui.scrollDownExtra,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.NextPage), Key: opts.GetKey(opts.Config.Universal.NextPage),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.pageDownExtrasPanel, Handler: gui.pageDownExtrasPanel,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.PrevPage), Key: opts.GetKey(opts.Config.Universal.PrevPage),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.pageUpExtrasPanel, Handler: gui.pageUpExtrasPanel,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoTop), Key: opts.GetKey(opts.Config.Universal.GotoTop),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToExtrasPanelTop, Handler: gui.goToExtrasPanelTop,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt), Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToExtrasPanelTop, Handler: gui.goToExtrasPanelTop,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoBottom), Key: opts.GetKey(opts.Config.Universal.GotoBottom),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToExtrasPanelBottom, Handler: gui.goToExtrasPanelBottom,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt), Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.goToExtrasPanelBottom, Handler: gui.goToExtrasPanelBottom,
}, },
{ {
ViewName: "extras", ViewName: "extras",
Tag: "navigation", Tag: "navigation",
Key: gocui.MouseLeft, Key: gocui.MouseLeft,
Modifier: gocui.ModNone, Modifier: gocui.ModNone,
Handler: self.handleFocusCommandLog, Handler: gui.handleFocusCommandLog,
}, },
} }
mouseKeybindings := []*gocui.ViewMouseBinding{} mouseKeybindings := []*gocui.ViewMouseBinding{}
for _, c := range self.State.Contexts.Flatten() { for _, c := range gui.State.Contexts.Flatten() {
viewName := c.GetViewName() viewName := c.GetViewName()
for _, binding := range c.GetKeybindings(opts) { for _, binding := range c.GetKeybindings(opts) {
// TODO: move all mouse keybindings into the mouse keybindings approach below // TODO: move all mouse keybindings into the mouse keybindings approach below
@ -402,15 +402,15 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.NextTab), Key: opts.GetKey(opts.Config.Universal.NextTab),
Handler: opts.Guards.NoPopupPanel(self.handleNextTab), Handler: opts.Guards.NoPopupPanel(gui.handleNextTab),
Description: self.c.Tr.NextTab, Description: gui.c.Tr.NextTab,
Tag: "navigation", Tag: "navigation",
}, },
{ {
ViewName: "", ViewName: "",
Key: opts.GetKey(opts.Config.Universal.PrevTab), Key: opts.GetKey(opts.Config.Universal.PrevTab),
Handler: opts.Guards.NoPopupPanel(self.handlePrevTab), Handler: opts.Guards.NoPopupPanel(gui.handlePrevTab),
Description: self.c.Tr.PrevTab, Description: gui.c.Tr.PrevTab,
Tag: "navigation", Tag: "navigation",
}, },
}...) }...)
@ -418,12 +418,12 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
return bindings, mouseKeybindings return bindings, mouseKeybindings
} }
func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []*gocui.ViewMouseBinding) { func (gui *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []*gocui.ViewMouseBinding) {
// if the search or filter prompt is open, we only want the keybindings for // if the search or filter prompt is open, we only want the keybindings for
// that context. It shouldn't be possible, for example, to open a menu while // that context. It shouldn't be possible, for example, to open a menu while
// the prompt is showing; you first need to confirm or cancel the search/filter. // the prompt is showing; you first need to confirm or cancel the search/filter.
if currentContext := self.State.ContextMgr.Current(); currentContext.GetKey() == context.SEARCH_CONTEXT_KEY { if currentContext := gui.State.ContextMgr.Current(); currentContext.GetKey() == context.SEARCH_CONTEXT_KEY {
bindings := currentContext.GetKeybindings(self.c.KeybindingsOpts()) bindings := currentContext.GetKeybindings(gui.c.KeybindingsOpts())
viewName := currentContext.GetViewName() viewName := currentContext.GetViewName()
for _, binding := range bindings { for _, binding := range bindings {
binding.ViewName = viewName binding.ViewName = viewName
@ -431,8 +431,8 @@ func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []
return bindings, nil return bindings, nil
} }
bindings, mouseBindings := self.GetInitialKeybindings() bindings, mouseBindings := gui.GetInitialKeybindings()
customBindings, err := self.CustomCommandsClient.GetCustomCommandKeybindings() customBindings, err := gui.CustomCommandsClient.GetCustomCommandKeybindings()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }