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:
@ -586,8 +586,8 @@ func (gui *Gui) resetState(startArgs appTypes.StartArgs) types.Context {
|
||||
return initialContext(contextTree, startArgs)
|
||||
}
|
||||
|
||||
func (self *Gui) getViewBufferManagerForView(view *gocui.View) *tasks.ViewBufferManager {
|
||||
manager, ok := self.viewBufferManagerMap[view.Name()]
|
||||
func (gui *Gui) getViewBufferManagerForView(view *gocui.View) *tasks.ViewBufferManager {
|
||||
manager, ok := gui.viewBufferManagerMap[view.Name()]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
@ -45,27 +45,27 @@ func (gui *Gui) validateNotInFilterMode() bool {
|
||||
}
|
||||
|
||||
// only to be called from the cheatsheet generate script. This mutates the Gui struct.
|
||||
func (self *Gui) GetCheatsheetKeybindings() []*types.Binding {
|
||||
self.g = &gocui.Gui{}
|
||||
if err := self.createAllViews(); err != nil {
|
||||
func (gui *Gui) GetCheatsheetKeybindings() []*types.Binding {
|
||||
gui.g = &gocui.Gui{}
|
||||
if err := gui.createAllViews(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// need to instantiate views
|
||||
self.helpers = helpers.NewStubHelpers()
|
||||
self.State = &GuiRepoState{}
|
||||
self.State.Contexts = self.contextTree()
|
||||
self.State.ContextMgr = NewContextMgr(self, self.State.Contexts)
|
||||
self.resetHelpersAndControllers()
|
||||
bindings, _ := self.GetInitialKeybindings()
|
||||
gui.helpers = helpers.NewStubHelpers()
|
||||
gui.State = &GuiRepoState{}
|
||||
gui.State.Contexts = gui.contextTree()
|
||||
gui.State.ContextMgr = NewContextMgr(gui, gui.State.Contexts)
|
||||
gui.resetHelpersAndControllers()
|
||||
bindings, _ := gui.GetInitialKeybindings()
|
||||
return bindings
|
||||
}
|
||||
|
||||
func (self *Gui) keybindingOpts() types.KeybindingsOpts {
|
||||
config := self.c.UserConfig().Keybinding
|
||||
func (gui *Gui) keybindingOpts() types.KeybindingsOpts {
|
||||
config := gui.c.UserConfig().Keybinding
|
||||
|
||||
guards := types.KeybindingGuards{
|
||||
OutsideFilterMode: self.outsideFilterMode,
|
||||
NoPopupPanel: self.noPopupPanel,
|
||||
OutsideFilterMode: gui.outsideFilterMode,
|
||||
NoPopupPanel: gui.noPopupPanel,
|
||||
}
|
||||
|
||||
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.
|
||||
func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) {
|
||||
opts := self.c.KeybindingsOpts()
|
||||
func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBinding) {
|
||||
opts := gui.c.KeybindingsOpts()
|
||||
|
||||
bindings := []*types.Binding{
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.OpenRecentRepos),
|
||||
Handler: opts.Guards.NoPopupPanel(self.helpers.Repos.CreateRecentReposMenu),
|
||||
Description: self.c.Tr.SwitchRepo,
|
||||
Handler: opts.Guards.NoPopupPanel(gui.helpers.Repos.CreateRecentReposMenu),
|
||||
Description: gui.c.Tr.SwitchRepo,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ScrollUpMain),
|
||||
Handler: self.scrollUpMain,
|
||||
Handler: gui.scrollUpMain,
|
||||
Alternative: "fn+up/shift+k",
|
||||
Description: self.c.Tr.ScrollUpMainWindow,
|
||||
Description: gui.c.Tr.ScrollUpMainWindow,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ScrollDownMain),
|
||||
Handler: self.scrollDownMain,
|
||||
Handler: gui.scrollDownMain,
|
||||
Alternative: "fn+down/shift+j",
|
||||
Description: self.c.Tr.ScrollDownMainWindow,
|
||||
Description: gui.c.Tr.ScrollDownMainWindow,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt1),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpMain,
|
||||
Handler: gui.scrollUpMain,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt1),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownMain,
|
||||
Handler: gui.scrollDownMain,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt2),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpMain,
|
||||
Handler: gui.scrollUpMain,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt2),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownMain,
|
||||
Handler: gui.scrollDownMain,
|
||||
},
|
||||
{
|
||||
ViewName: "files",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyPathToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyPathToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "localBranches",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyBranchNameToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyBranchNameToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "remoteBranches",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyBranchNameToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyBranchNameToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "tags",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyTagToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyTagToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "commits",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyCommitHashToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemCommitHashToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyCommitHashToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "commits",
|
||||
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
|
||||
Handler: self.helpers.CherryPick.Reset,
|
||||
Description: self.c.Tr.ResetCherryPick,
|
||||
Handler: gui.helpers.CherryPick.Reset,
|
||||
Description: gui.c.Tr.ResetCherryPick,
|
||||
},
|
||||
{
|
||||
ViewName: "reflogCommits",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyCommitHashToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyCommitHashToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "subCommits",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemCommitHashToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyCommitHashToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemCommitHashToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyCommitHashToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "information",
|
||||
Key: gocui.MouseLeft,
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.handleInfoClick,
|
||||
Handler: gui.handleInfoClick,
|
||||
},
|
||||
{
|
||||
ViewName: "commitFiles",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyPathToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopyPathToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.ExtrasMenu),
|
||||
Handler: opts.Guards.NoPopupPanel(self.handleCreateExtrasMenuPanel),
|
||||
Description: self.c.Tr.OpenCommandLogMenu,
|
||||
Tooltip: self.c.Tr.OpenCommandLogMenuTooltip,
|
||||
Handler: opts.Guards.NoPopupPanel(gui.handleCreateExtrasMenuPanel),
|
||||
Description: gui.c.Tr.OpenCommandLogMenu,
|
||||
Tooltip: gui.c.Tr.OpenCommandLogMenuTooltip,
|
||||
OpensMenu: true,
|
||||
},
|
||||
{
|
||||
ViewName: "main",
|
||||
Key: gocui.MouseWheelDown,
|
||||
Handler: self.scrollDownMain,
|
||||
Description: self.c.Tr.ScrollDown,
|
||||
Handler: gui.scrollDownMain,
|
||||
Description: gui.c.Tr.ScrollDown,
|
||||
Alternative: "fn+up",
|
||||
},
|
||||
{
|
||||
ViewName: "main",
|
||||
Key: gocui.MouseWheelUp,
|
||||
Handler: self.scrollUpMain,
|
||||
Description: self.c.Tr.ScrollUp,
|
||||
Handler: gui.scrollUpMain,
|
||||
Description: gui.c.Tr.ScrollUp,
|
||||
Alternative: "fn+down",
|
||||
},
|
||||
{
|
||||
ViewName: "secondary",
|
||||
Key: gocui.MouseWheelDown,
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownSecondary,
|
||||
Handler: gui.scrollDownSecondary,
|
||||
},
|
||||
{
|
||||
ViewName: "secondary",
|
||||
Key: gocui.MouseWheelUp,
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpSecondary,
|
||||
Handler: gui.scrollUpSecondary,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpConfirmationPanel,
|
||||
Handler: gui.scrollUpConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownConfirmationPanel,
|
||||
Handler: gui.scrollDownConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpConfirmationPanel,
|
||||
Handler: gui.scrollUpConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownConfirmationPanel,
|
||||
Handler: gui.scrollDownConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: gocui.MouseWheelUp,
|
||||
Handler: self.scrollUpConfirmationPanel,
|
||||
Handler: gui.scrollUpConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: gocui.MouseWheelDown,
|
||||
Handler: self.scrollDownConfirmationPanel,
|
||||
Handler: gui.scrollDownConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextPage),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.pageDownConfirmationPanel,
|
||||
Handler: gui.pageDownConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevPage),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.pageUpConfirmationPanel,
|
||||
Handler: gui.pageUpConfirmationPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoTop),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToConfirmationPanelTop,
|
||||
Handler: gui.goToConfirmationPanelTop,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToConfirmationPanelTop,
|
||||
Handler: gui.goToConfirmationPanelTop,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoBottom),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToConfirmationPanelBottom,
|
||||
Handler: gui.goToConfirmationPanelBottom,
|
||||
},
|
||||
{
|
||||
ViewName: "confirmation",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToConfirmationPanelBottom,
|
||||
Handler: gui.goToConfirmationPanelBottom,
|
||||
},
|
||||
{
|
||||
ViewName: "submodules",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopySubmoduleNameToClipboard,
|
||||
Handler: gui.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: gui.c.Tr.CopySubmoduleNameToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: gocui.MouseWheelUp,
|
||||
Handler: self.scrollUpExtra,
|
||||
Handler: gui.scrollUpExtra,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: gocui.MouseWheelDown,
|
||||
Handler: self.scrollDownExtra,
|
||||
Handler: gui.scrollDownExtra,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Tag: "navigation",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpExtra,
|
||||
Handler: gui.scrollUpExtra,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Tag: "navigation",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollUpExtra,
|
||||
Handler: gui.scrollUpExtra,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Tag: "navigation",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownExtra,
|
||||
Handler: gui.scrollDownExtra,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Tag: "navigation",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.scrollDownExtra,
|
||||
Handler: gui.scrollDownExtra,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextPage),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.pageDownExtrasPanel,
|
||||
Handler: gui.pageDownExtrasPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevPage),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.pageUpExtrasPanel,
|
||||
Handler: gui.pageUpExtrasPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoTop),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToExtrasPanelTop,
|
||||
Handler: gui.goToExtrasPanelTop,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToExtrasPanelTop,
|
||||
Handler: gui.goToExtrasPanelTop,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoBottom),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToExtrasPanelBottom,
|
||||
Handler: gui.goToExtrasPanelBottom,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.goToExtrasPanelBottom,
|
||||
Handler: gui.goToExtrasPanelBottom,
|
||||
},
|
||||
{
|
||||
ViewName: "extras",
|
||||
Tag: "navigation",
|
||||
Key: gocui.MouseLeft,
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: self.handleFocusCommandLog,
|
||||
Handler: gui.handleFocusCommandLog,
|
||||
},
|
||||
}
|
||||
|
||||
mouseKeybindings := []*gocui.ViewMouseBinding{}
|
||||
for _, c := range self.State.Contexts.Flatten() {
|
||||
for _, c := range gui.State.Contexts.Flatten() {
|
||||
viewName := c.GetViewName()
|
||||
for _, binding := range c.GetKeybindings(opts) {
|
||||
// TODO: move all mouse keybindings into the mouse keybindings approach below
|
||||
@ -402,15 +402,15 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.NextTab),
|
||||
Handler: opts.Guards.NoPopupPanel(self.handleNextTab),
|
||||
Description: self.c.Tr.NextTab,
|
||||
Handler: opts.Guards.NoPopupPanel(gui.handleNextTab),
|
||||
Description: gui.c.Tr.NextTab,
|
||||
Tag: "navigation",
|
||||
},
|
||||
{
|
||||
ViewName: "",
|
||||
Key: opts.GetKey(opts.Config.Universal.PrevTab),
|
||||
Handler: opts.Guards.NoPopupPanel(self.handlePrevTab),
|
||||
Description: self.c.Tr.PrevTab,
|
||||
Handler: opts.Guards.NoPopupPanel(gui.handlePrevTab),
|
||||
Description: gui.c.Tr.PrevTab,
|
||||
Tag: "navigation",
|
||||
},
|
||||
}...)
|
||||
@ -418,12 +418,12 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
||||
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
|
||||
// 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.
|
||||
if currentContext := self.State.ContextMgr.Current(); currentContext.GetKey() == context.SEARCH_CONTEXT_KEY {
|
||||
bindings := currentContext.GetKeybindings(self.c.KeybindingsOpts())
|
||||
if currentContext := gui.State.ContextMgr.Current(); currentContext.GetKey() == context.SEARCH_CONTEXT_KEY {
|
||||
bindings := currentContext.GetKeybindings(gui.c.KeybindingsOpts())
|
||||
viewName := currentContext.GetViewName()
|
||||
for _, binding := range bindings {
|
||||
binding.ViewName = viewName
|
||||
@ -431,8 +431,8 @@ func (self *Gui) GetInitialKeybindingsWithCustomCommands() ([]*types.Binding, []
|
||||
return bindings, nil
|
||||
}
|
||||
|
||||
bindings, mouseBindings := self.GetInitialKeybindings()
|
||||
customBindings, err := self.CustomCommandsClient.GetCustomCommandKeybindings()
|
||||
bindings, mouseBindings := gui.GetInitialKeybindings()
|
||||
customBindings, err := gui.CustomCommandsClient.GetCustomCommandKeybindings()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user