Rename Key to Keys in Binding, KeybindingsOpts, and MenuItem

This is a straight rename with no other code changes. Doing it in a separate
commit to keep the diff of the previous one somewhat readable.
This commit is contained in:
Stefan Haller 2026-05-10 17:09:20 +02:00
parent 3d18ee8f91
commit 26366641c0
62 changed files with 525 additions and 525 deletions

View file

@ -145,7 +145,7 @@ func getBindingSections(bindings []*types.Binding, tr *i18n.TranslationSet) []*b
return false
}
return (binding.Description != "" || binding.Alternative != "") && len(binding.Key) > 0
return (binding.Description != "" || binding.Alternative != "") && len(binding.Keys) > 0
})
bindingsByHeader := lo.GroupBy(bindingsToDisplay, func(binding *types.Binding) header {
@ -156,7 +156,7 @@ func getBindingSections(bindings []*types.Binding, tr *i18n.TranslationSet) []*b
bindingsByHeader,
func(header header, hBindings []*types.Binding) headerWithBindings {
uniqBindings := lo.UniqBy(hBindings, func(binding *types.Binding) string {
return binding.Description + config.LabelForKey(binding.Key[0])
return binding.Description + config.LabelForKey(binding.Keys[0])
})
return headerWithBindings{
@ -214,7 +214,7 @@ func formatTitle(title string) string {
}
func formatBinding(binding *types.Binding) string {
action := config.LabelForKey(binding.Key[0])
action := config.LabelForKey(binding.Keys[0])
description := binding.Description
if binding.Alternative != "" {
action += fmt.Sprintf(" (%s)", binding.Alternative)

View file

@ -28,7 +28,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
expected: []*bindingSection{
@ -38,7 +38,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -50,7 +50,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "",
Description: "quit",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
expected: []*bindingSection{
@ -60,7 +60,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "",
Description: "quit",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -72,17 +72,17 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "unstage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "submodules",
Description: "drop submodule",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
expected: []*bindingSection{
@ -92,12 +92,12 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "unstage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -107,7 +107,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "submodules",
Description: "drop submodule",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -119,23 +119,23 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "unstage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "scroll",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
{
ViewName: "commits",
Description: "revert commit",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
expected: []*bindingSection{
@ -145,7 +145,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "scroll",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
},
@ -156,7 +156,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "commits",
Description: "revert commit",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -166,12 +166,12 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "unstage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -183,34 +183,34 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "unstage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "scroll",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
{
ViewName: "commits",
Description: "revert commit",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "commits",
Description: "scroll",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
{
ViewName: "commits",
Description: "page up",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
},
@ -221,13 +221,13 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "scroll",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
{
ViewName: "commits",
Description: "page up",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
Tag: "navigation",
},
},
@ -238,7 +238,7 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "commits",
Description: "revert commit",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},
@ -248,12 +248,12 @@ func TestGetBindingSections(t *testing.T) {
{
ViewName: "files",
Description: "stage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
{
ViewName: "files",
Description: "unstage file",
Key: []gocui.Key{gocui.NewKeyRune('a')},
Keys: []gocui.Key{gocui.NewKeyRune('a')},
},
},
},

View file

@ -76,7 +76,7 @@ func NewMenuViewModel(c *ContextCommon) *MenuViewModel {
if filterKeybindings {
// Allow searching all configured keybindings of each item, even though only the
// first one is shown in the menu.
return lo.Map(item.Key, func(k gocui.Key, _ int) string {
return lo.Map(item.Keys, func(k gocui.Key, _ int) string {
return config.LabelForKey(k)
})
}
@ -143,8 +143,8 @@ func (self *MenuViewModel) GetDisplayStrings(_ int, _ int) [][]string {
}
keyLabel := ""
if len(item.Key) > 0 {
keyLabel = style.FgCyan.Sprint(config.LabelForKey(item.Key[0]))
if len(item.Keys) > 0 {
keyLabel = style.FgCyan.Sprint(config.LabelForKey(item.Keys[0]))
}
checkMark := ""
@ -210,12 +210,12 @@ func (self *MenuViewModel) GetNonModelItems() []*NonModelItem {
func (self *MenuContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
basicBindings := self.ListContextTrait.GetKeybindings(opts)
menuItemsWithKeys := lo.Filter(self.menuItems, func(item *types.MenuItem, _ int) bool {
return len(item.Key) > 0
return len(item.Keys) > 0
})
menuItemBindings := lo.Map(menuItemsWithKeys, func(item *types.MenuItem, _ int) *types.Binding {
return &types.Binding{
Key: item.Key,
Keys: item.Keys,
Handler: func() error { return self.OnMenuPress(item) },
}
})

View file

@ -51,7 +51,7 @@ func NewBasicCommitsController(c *ControllerCommon, context ContainsCommits) *Ba
func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Commits.CheckoutCommit),
Keys: opts.GetKeys(opts.Config.Commits.CheckoutCommit),
Handler: self.withItem(self.checkout),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Checkout,
@ -59,7 +59,7 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.CopyCommitAttributeToClipboard),
Keys: opts.GetKeys(opts.Config.Commits.CopyCommitAttributeToClipboard),
Handler: self.withItem(self.copyCommitAttribute),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.CopyCommitAttributeToClipboard,
@ -67,13 +67,13 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.OpenInBrowser),
Keys: opts.GetKeys(opts.Config.Commits.OpenInBrowser),
Handler: self.withItem(self.openInBrowser),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenCommitInBrowser,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.withItem(self.newBranch),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.CreateNewBranchFromCommit,
@ -83,14 +83,14 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
// panel. But I find it important that this ends up next to "New Branch", and I couldn't
// find another way to achieve this. It's not such a big deal to have it in subcommits and
// reflog too, I'd say.
Key: opts.GetKey(opts.Config.Branches.MoveCommitsToNewBranch),
Keys: opts.GetKeys(opts.Config.Branches.MoveCommitsToNewBranch),
Handler: self.c.Helpers().Refs.MoveCommitsToNewBranch,
GetDisabledReason: self.c.Helpers().Refs.CanMoveCommitsToNewBranch,
Description: self.c.Tr.MoveCommitsToNewBranch,
Tooltip: self.c.Tr.MoveCommitsToNewBranchTooltip,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Keys: opts.GetKeys(opts.Config.Commits.ViewResetOptions),
Handler: self.withItem(self.createResetMenu),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.ViewResetOptions,
@ -99,7 +99,7 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.CherryPickCopy),
Keys: opts.GetKeys(opts.Config.Commits.CherryPickCopy),
Handler: self.withItem(self.copyRange),
GetDisabledReason: self.require(self.itemRangeSelected(self.canCopyCommits)),
Description: self.c.Tr.CherryPickCopy,
@ -112,18 +112,18 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
Keys: opts.GetKeys(opts.Config.Commits.ResetCherryPick),
Handler: self.c.Helpers().CherryPick.Reset,
Description: self.c.Tr.ResetCherryPick,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Keys: opts.GetKeys(opts.Config.Universal.OpenDiffTool),
Handler: self.withItem(self.openDiffTool),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenDiffTool,
},
{
Key: opts.GetKey(opts.Config.Commits.SelectCommitsOfCurrentBranch),
Keys: opts.GetKeys(opts.Config.Commits.SelectCommitsOfCurrentBranch),
Handler: self.selectCommitsOfCurrentBranch,
GetDisabledReason: self.require(self.canSelectCommitsOfCurrentBranch),
Description: self.c.Tr.SelectCommitsOfCurrentBranch,
@ -163,14 +163,14 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
OnPress: func() error {
return self.copyCommitSubjectToClipboard(commit)
},
Key: menuKey('s'),
Keys: menuKey('s'),
},
{
Label: self.c.Tr.CommitMessage,
OnPress: func() error {
return self.copyCommitMessageToClipboard(commit)
},
Key: menuKey('m'),
Keys: menuKey('m'),
},
{
Label: self.c.Tr.CommitMessageBody,
@ -178,28 +178,28 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
OnPress: func() error {
return self.copyCommitMessageBodyToClipboard(commitMessageBody)
},
Key: menuKey('b'),
Keys: menuKey('b'),
},
{
Label: self.c.Tr.CommitURL,
OnPress: func() error {
return self.copyCommitURLToClipboard(commit)
},
Key: menuKey('u'),
Keys: menuKey('u'),
},
{
Label: self.c.Tr.CommitDiff,
OnPress: func() error {
return self.copyCommitDiffToClipboard(commit)
},
Key: menuKey('d'),
Keys: menuKey('d'),
},
{
Label: self.c.Tr.CommitAuthor,
OnPress: func() error {
return self.copyAuthorToClipboard(commit)
},
Key: menuKey('a'),
Keys: menuKey('a'),
},
}
@ -208,7 +208,7 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e
OnPress: func() error {
return self.copyCommitTagsToClipboard(commit)
},
Key: menuKey('t'),
Keys: menuKey('t'),
}
if len(commit.Tags) == 0 {

View file

@ -38,7 +38,7 @@ func NewBisectController(
func (self *BisectController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Commits.ViewBisectOptions),
Keys: opts.GetKeys(opts.Config.Commits.ViewBisectOptions),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.openMenu)),
Description: self.c.Tr.ViewBisectOptions,
OpensMenu: true,
@ -101,7 +101,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
return self.afterMark(selectCurrentAfter, waitToReselect)
},
DisabledReason: singleItemIfNotBisecting,
Key: menuKey('b'),
Keys: menuKey('b'),
},
{
Label: fmt.Sprintf(self.c.Tr.Bisect.Mark, shortHashToMark, info.OldTerm()),
@ -114,7 +114,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
return self.afterMark(selectCurrentAfter, waitToReselect)
},
DisabledReason: singleItemIfNotBisecting,
Key: menuKey('g'),
Keys: menuKey('g'),
},
{
Label: fmt.Sprintf(self.c.Tr.Bisect.SkipCurrent, shortHashToMark),
@ -127,7 +127,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
return self.afterMark(selectCurrentAfter, waitToReselect)
},
DisabledReason: singleItemIfNotBisecting,
Key: menuKey('s'),
Keys: menuKey('s'),
},
}
if info.GetCurrentHash() != "" && info.GetCurrentHash() != commit.Hash() {
@ -142,7 +142,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
return self.afterMark(selectCurrentAfter, waitToReselect)
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('S'),
Keys: menuKey('S'),
}))
}
menuItems = append(menuItems, lo.ToPtr(types.MenuItem{
@ -150,7 +150,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c
OnPress: func() error {
return self.c.Helpers().Bisect.Reset()
},
Key: menuKey('r'),
Keys: menuKey('r'),
}))
return self.c.Menu(types.CreateMenuOptions{
@ -179,7 +179,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo,
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('b'),
Keys: menuKey('b'),
},
{
Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortHash(), info.OldTerm()),
@ -197,7 +197,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo,
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('g'),
Keys: menuKey('g'),
},
{
Label: self.c.Tr.Bisect.ChooseTerms,
@ -222,7 +222,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo,
})
return nil
},
Key: menuKey('t'),
Keys: menuKey('t'),
},
},
})

View file

@ -45,7 +45,7 @@ func NewBranchesController(
func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.press),
GetDisabledReason: self.require(
self.singleItemSelected(),
@ -56,64 +56,64 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.withItem(self.newBranch),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.NewBranch,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.MoveCommitsToNewBranch),
Keys: opts.GetKeys(opts.Config.Branches.MoveCommitsToNewBranch),
Handler: self.c.Helpers().Refs.MoveCommitsToNewBranch,
GetDisabledReason: self.c.Helpers().Refs.CanMoveCommitsToNewBranch,
Description: self.c.Tr.MoveCommitsToNewBranch,
Tooltip: self.c.Tr.MoveCommitsToNewBranchTooltip,
},
{
Key: opts.GetKey(opts.Config.Branches.CreatePullRequest),
Keys: opts.GetKeys(opts.Config.Branches.CreatePullRequest),
Handler: self.withItem(self.handleCreatePullRequest),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.CreatePullRequest,
},
{
Key: opts.GetKey(opts.Config.Branches.ViewPullRequestOptions),
Keys: opts.GetKeys(opts.Config.Branches.ViewPullRequestOptions),
Handler: self.withItem(self.handleCreatePullRequestMenu),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.CreatePullRequestOptions,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Branches.OpenPullRequestInBrowser),
Keys: opts.GetKeys(opts.Config.Branches.OpenPullRequestInBrowser),
Handler: self.withItem(self.openPRInBrowser),
GetDisabledReason: self.require(self.singleItemSelected(self.branchHasPR)),
Description: self.c.Tr.OpenPullRequestInBrowser,
},
{
Key: opts.GetKey(opts.Config.Branches.CopyPullRequestURL),
Keys: opts.GetKeys(opts.Config.Branches.CopyPullRequestURL),
Handler: self.copyPullRequestURL,
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.CopyPullRequestURL,
},
{
Key: opts.GetKey(opts.Config.Branches.CheckoutBranchByName),
Keys: opts.GetKeys(opts.Config.Branches.CheckoutBranchByName),
Handler: self.checkoutByName,
Description: self.c.Tr.CheckoutByName,
Tooltip: self.c.Tr.CheckoutByNameTooltip,
},
{
Key: opts.GetKey(opts.Config.Branches.CheckoutPreviousBranch),
Keys: opts.GetKeys(opts.Config.Branches.CheckoutPreviousBranch),
Handler: self.checkoutPreviousBranch,
Description: self.c.Tr.CheckoutPreviousBranch,
},
{
Key: opts.GetKey(opts.Config.Branches.ForceCheckoutBranch),
Keys: opts.GetKeys(opts.Config.Branches.ForceCheckoutBranch),
Handler: self.forceCheckout,
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.ForceCheckout,
Tooltip: self.c.Tr.ForceCheckoutTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItems(self.delete),
GetDisabledReason: self.require(self.itemRangeSelected(self.branchesAreReal)),
Description: self.c.Tr.Delete,
@ -122,7 +122,7 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.RebaseBranch),
Keys: opts.GetKeys(opts.Config.Branches.RebaseBranch),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.rebase)),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.RebaseBranch,
@ -131,7 +131,7 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.MergeIntoCurrentBranch),
Keys: opts.GetKeys(opts.Config.Branches.MergeIntoCurrentBranch),
Handler: opts.Guards.OutsideFilterMode(self.merge),
GetDisabledReason: self.require(self.singleItemSelected(self.notMergingIntoYourself)),
Description: self.c.Tr.Merge,
@ -140,26 +140,26 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Branches.FastForward),
Keys: opts.GetKeys(opts.Config.Branches.FastForward),
Handler: self.withItem(self.fastForward),
GetDisabledReason: self.require(self.singleItemSelected(self.branchIsReal)),
Description: self.c.Tr.FastForward,
Tooltip: self.c.Tr.FastForwardTooltip,
},
{
Key: opts.GetKey(opts.Config.Branches.CreateTag),
Keys: opts.GetKeys(opts.Config.Branches.CreateTag),
Handler: self.withItem(self.createTag),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.NewTag,
},
{
Key: opts.GetKey(opts.Config.Branches.SortOrder),
Keys: opts.GetKeys(opts.Config.Branches.SortOrder),
Handler: self.createSortMenu,
Description: self.c.Tr.SortOrder,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Keys: opts.GetKeys(opts.Config.Commits.ViewResetOptions),
Handler: self.withItem(self.createResetMenu),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.ViewResetOptions,
@ -167,13 +167,13 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.RenameBranch),
Keys: opts.GetKeys(opts.Config.Branches.RenameBranch),
Handler: self.withItem(self.rename),
GetDisabledReason: self.require(self.singleItemSelected(self.branchIsReal)),
Description: self.c.Tr.RenameBranch,
},
{
Key: opts.GetKey(opts.Config.Branches.SetUpstream),
Keys: opts.GetKeys(opts.Config.Branches.SetUpstream),
Handler: self.withItem(self.viewUpstreamOptions),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.ViewBranchUpstreamOptions,
@ -183,7 +183,7 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Keys: opts.GetKeys(opts.Config.Universal.OpenDiffTool),
Handler: self.withItem(func(selectedBranch *models.Branch) error {
return self.c.Helpers().Diff.OpenDiffToolForRef(selectedBranch)
}),
@ -300,7 +300,7 @@ func (self *BranchesController) viewUpstreamOptions(selectedBranch *models.Branc
)
viewDivergenceFromBaseBranchItem := &types.MenuItem{
LabelColumns: []string{label},
Key: menuKey('b'),
Keys: menuKey('b'),
OnPress: func() error {
branch := self.context().GetSelected()
if branch == nil {
@ -333,7 +333,7 @@ func (self *BranchesController) viewUpstreamOptions(selectedBranch *models.Branc
})
return nil
},
Key: menuKey('u'),
Keys: menuKey('u'),
}
setUpstreamItem := &types.MenuItem{
@ -358,7 +358,7 @@ func (self *BranchesController) viewUpstreamOptions(selectedBranch *models.Branc
return nil
})
},
Key: menuKey('s'),
Keys: menuKey('s'),
}
upstreamResetOptions := utils.ResolvePlaceholderString(
@ -391,7 +391,7 @@ func (self *BranchesController) viewUpstreamOptions(selectedBranch *models.Branc
return nil
},
Tooltip: upstreamResetTooltip,
Key: menuKey('g'),
Keys: menuKey('g'),
}
upstreamRebaseItem := &types.MenuItem{
@ -404,7 +404,7 @@ func (self *BranchesController) viewUpstreamOptions(selectedBranch *models.Branc
return nil
},
Tooltip: upstreamRebaseTooltip,
Key: menuKey('r'),
Keys: menuKey('r'),
}
if !selectedBranch.IsTrackingRemote() {
@ -624,7 +624,7 @@ func (self *BranchesController) delete(branches []*models.Branch) error {
localDeleteItem := &types.MenuItem{
Label: lo.Ternary(len(branches) > 1, self.c.Tr.DeleteLocalBranches, self.c.Tr.DeleteLocalBranch),
Key: menuKey('c'),
Keys: menuKey('c'),
OnPress: func() error {
return self.localDelete(branches)
},
@ -635,7 +635,7 @@ func (self *BranchesController) delete(branches []*models.Branch) error {
remoteDeleteItem := &types.MenuItem{
Label: lo.Ternary(len(branches) > 1, self.c.Tr.DeleteRemoteBranches, self.c.Tr.DeleteRemoteBranch),
Key: menuKey('r'),
Keys: menuKey('r'),
OnPress: func() error {
return self.remoteDelete(branches)
},
@ -648,7 +648,7 @@ func (self *BranchesController) delete(branches []*models.Branch) error {
deleteBothItem := &types.MenuItem{
Label: lo.Ternary(len(branches) > 1, self.c.Tr.DeleteLocalAndRemoteBranches, self.c.Tr.DeleteLocalAndRemoteBranch),
Key: menuKey('b'),
Keys: menuKey('b'),
OnPress: func() error {
return self.localAndRemoteDelete(branches)
},

View file

@ -25,23 +25,23 @@ func NewCommitDescriptionController(
func (self *CommitDescriptionController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
Handler: self.handleTogglePanel,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.close,
},
{
Key: opts.GetKey(opts.Config.Universal.ConfirmInEditor),
Keys: opts.GetKeys(opts.Config.Universal.ConfirmInEditor),
Handler: self.confirm,
},
{
Key: opts.GetKey(opts.Config.Universal.ConfirmInEditorAlt),
Keys: opts.GetKeys(opts.Config.Universal.ConfirmInEditorAlt),
Handler: self.confirm,
},
{
Key: opts.GetKey(opts.Config.CommitMessage.CommitMenu),
Keys: opts.GetKeys(opts.Config.CommitMessage.CommitMenu),
Handler: self.openCommitMenu,
},
}

View file

@ -29,29 +29,29 @@ func NewCommitMessageController(
func (self *CommitMessageController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.SubmitEditorText),
Keys: opts.GetKeys(opts.Config.Universal.SubmitEditorText),
Handler: self.confirm,
Description: self.c.Tr.Confirm,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.close,
Description: self.c.Tr.Close,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: self.handlePreviousCommit,
},
{
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: self.handleNextCommit,
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
Handler: self.handleTogglePanel,
},
{
Key: opts.GetKey(opts.Config.CommitMessage.CommitMenu),
Keys: opts.GetKeys(opts.Config.CommitMessage.CommitMenu),
Handler: self.openCommitMenu,
},
}

View file

@ -45,13 +45,13 @@ func NewCommitFilesController(
func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Files.CopyFileInfoToClipboard),
Keys: opts.GetKeys(opts.Config.Files.CopyFileInfoToClipboard),
Handler: self.openCopyMenu,
Description: self.c.Tr.CopyToClipboardMenu,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.CommitFiles.CheckoutCommitFile),
Keys: opts.GetKeys(opts.Config.CommitFiles.CheckoutCommitFile),
Handler: self.withItem(self.checkout),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Checkout,
@ -59,7 +59,7 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItems(self.discard),
GetDisabledReason: self.require(self.itemsSelected(self.canDiscardFileChanges)),
Description: self.c.Tr.Discard,
@ -67,14 +67,14 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.withItem(self.open),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.withItems(self.edit),
GetDisabledReason: self.require(self.itemsSelected(self.canEditFiles)),
Description: self.c.Tr.Edit,
@ -82,13 +82,13 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Keys: opts.GetKeys(opts.Config.Universal.OpenDiffTool),
Handler: self.withItem(self.openDiffTool),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenDiffTool,
},
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItems(self.toggleForPatch),
GetDisabledReason: self.require(self.itemsSelected()),
Description: self.c.Tr.ToggleAddToPatch,
@ -98,7 +98,7 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleStagedAll),
Keys: opts.GetKeys(opts.Config.Files.ToggleStagedAll),
Handler: self.withItem(self.toggleAllForPatch),
Description: self.c.Tr.ToggleAllInPatch,
Tooltip: utils.ResolvePlaceholderString(self.c.Tr.ToggleAllInPatchTooltip,
@ -106,27 +106,27 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
),
},
{
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Handler: self.withItem(self.enter),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.EnterCommitFile,
Tooltip: self.c.Tr.EnterCommitFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleTreeView),
Keys: opts.GetKeys(opts.Config.Files.ToggleTreeView),
Handler: self.toggleTreeView,
Description: self.c.Tr.ToggleTreeView,
Tooltip: self.c.Tr.ToggleTreeViewTooltip,
},
{
Key: opts.GetKey(opts.Config.Files.CollapseAll),
Keys: opts.GetKeys(opts.Config.Files.CollapseAll),
Handler: self.collapseAll,
Description: self.c.Tr.CollapseAll,
Tooltip: self.c.Tr.CollapseAllTooltip,
GetDisabledReason: self.require(self.isInTreeMode),
},
{
Key: opts.GetKey(opts.Config.Files.ExpandAll),
Keys: opts.GetKeys(opts.Config.Files.ExpandAll),
Handler: self.expandAll,
Description: self.c.Tr.ExpandAll,
Tooltip: self.c.Tr.ExpandAllTooltip,
@ -230,7 +230,7 @@ func (self *CommitFilesController) openCopyMenu() error {
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('n'),
Keys: menuKey('n'),
}
copyRelativePathItem := &types.MenuItem{
Label: self.c.Tr.CopyRelativeFilePath,
@ -242,7 +242,7 @@ func (self *CommitFilesController) openCopyMenu() error {
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('p'),
Keys: menuKey('p'),
}
copyAbsolutePathItem := &types.MenuItem{
Label: self.c.Tr.CopyAbsoluteFilePath,
@ -258,7 +258,7 @@ func (self *CommitFilesController) openCopyMenu() error {
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('P'),
Keys: menuKey('P'),
}
copyFileDiffItem := &types.MenuItem{
Label: self.c.Tr.CopySelectedDiff,
@ -266,7 +266,7 @@ func (self *CommitFilesController) openCopyMenu() error {
return self.copyDiffToClipboard(node.GetPath(), self.c.Tr.FileDiffCopiedToast)
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('s'),
Keys: menuKey('s'),
}
copyAllDiff := &types.MenuItem{
Label: self.c.Tr.CopyAllFilesDiff,
@ -274,7 +274,7 @@ func (self *CommitFilesController) openCopyMenu() error {
return self.copyDiffToClipboard(".", self.c.Tr.AllFilesDiffCopiedToast)
},
DisabledReason: self.require(self.itemsSelected())(),
Key: menuKey('a'),
Keys: menuKey('a'),
}
copyFileContentItem := &types.MenuItem{
Label: self.c.Tr.CopyFileContent,
@ -295,7 +295,7 @@ func (self *CommitFilesController) openCopyMenu() error {
}
return nil
}))(),
Key: menuKey('c'),
Keys: menuKey('c'),
}
return self.c.Menu(types.CreateMenuOptions{

View file

@ -24,19 +24,19 @@ func NewConfirmationController(
func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Confirm),
Keys: opts.GetKeys(opts.Config.Universal.Confirm),
Handler: func() error { return self.context().State.OnConfirm() },
Description: self.c.Tr.Confirm,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: func() error { return self.context().State.OnClose() },
Description: self.c.Tr.CloseCancel,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: self.handleCopyToClipboard,
Description: self.c.Tr.CopyToClipboardMenu,
DisplayOnScreen: true,

View file

@ -30,13 +30,13 @@ func NewContextLinesController(
func (self *ContextLinesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.IncreaseContextInDiffView),
Keys: opts.GetKeys(opts.Config.Universal.IncreaseContextInDiffView),
Handler: self.Increase,
Description: self.c.Tr.IncreaseContextInDiffView,
Tooltip: self.c.Tr.IncreaseContextInDiffViewTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.DecreaseContextInDiffView),
Keys: opts.GetKeys(opts.Config.Universal.DecreaseContextInDiffView),
Handler: self.Decrease,
Description: self.c.Tr.DecreaseContextInDiffView,
Tooltip: self.c.Tr.DecreaseContextInDiffViewTooltip,

View file

@ -31,19 +31,19 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
Label: self.c.Tr.ResetPatch,
Tooltip: self.c.Tr.ResetPatchTooltip,
OnPress: self.c.Helpers().PatchBuilding.Reset,
Key: menuKey('c'),
Keys: menuKey('c'),
},
{
Label: self.c.Tr.ApplyPatch,
Tooltip: self.c.Tr.ApplyPatchTooltip,
OnPress: func() error { return self.handleApplyPatch(false) },
Key: menuKey('a'),
Keys: menuKey('a'),
},
{
Label: self.c.Tr.ApplyPatchInReverse,
Tooltip: self.c.Tr.ApplyPatchInReverseTooltip,
OnPress: func() error { return self.handleApplyPatch(true) },
Key: menuKey('r'),
Keys: menuKey('r'),
},
}
@ -53,25 +53,25 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
Label: fmt.Sprintf(self.c.Tr.RemovePatchFromOriginalCommit, utils.ShortHash(self.c.Git().Patch.PatchBuilder.To)),
Tooltip: self.c.Tr.RemovePatchFromOriginalCommitTooltip,
OnPress: self.handleDeletePatchFromCommit,
Key: menuKey('d'),
Keys: menuKey('d'),
},
{
Label: self.c.Tr.MovePatchOutIntoIndex,
Tooltip: self.c.Tr.MovePatchOutIntoIndexTooltip,
OnPress: self.handleMovePatchIntoWorkingTree,
Key: menuKey('i'),
Keys: menuKey('i'),
},
{
Label: self.c.Tr.MovePatchIntoNewCommit,
Tooltip: self.c.Tr.MovePatchIntoNewCommitTooltip,
OnPress: self.handlePullPatchIntoNewCommit,
Key: menuKey('n'),
Keys: menuKey('n'),
},
{
Label: self.c.Tr.MovePatchIntoNewCommitBefore,
Tooltip: self.c.Tr.MovePatchIntoNewCommitBeforeTooltip,
OnPress: self.handlePullPatchIntoNewCommitBefore,
Key: menuKey('N'),
Keys: menuKey('N'),
},
}...)
@ -93,7 +93,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
Label: fmt.Sprintf(self.c.Tr.MovePatchToSelectedCommit, selectedCommit.Hash()),
Tooltip: self.c.Tr.MovePatchToSelectedCommitTooltip,
OnPress: self.handleMovePatchToSelectedCommit,
Key: menuKey('m'),
Keys: menuKey('m'),
DisabledReason: disabledReason,
},
}, menuItems[1:]...,
@ -107,7 +107,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
{
Label: self.c.Tr.CopyPatchToClipboard,
OnPress: func() error { return self.copyPatchToClipboard() },
Key: menuKey('y'),
Keys: menuKey('y'),
},
}...)

View file

@ -42,7 +42,7 @@ func NewFilesController(
func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItems(self.press),
GetDisabledReason: self.require(self.withFileTreeViewModelMutex(self.itemsSelected())),
Description: self.c.Tr.Stage,
@ -50,46 +50,46 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.OpenStatusFilter),
Keys: opts.GetKeys(opts.Config.Files.OpenStatusFilter),
Handler: self.handleStatusFilterPressed,
Description: self.c.Tr.FileFilter,
},
{
Key: opts.GetKey(opts.Config.Files.CopyFileInfoToClipboard),
Keys: opts.GetKeys(opts.Config.Files.CopyFileInfoToClipboard),
Handler: self.openCopyMenu,
Description: self.c.Tr.CopyToClipboardMenu,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChanges),
Keys: opts.GetKeys(opts.Config.Files.CommitChanges),
Handler: self.c.Helpers().WorkingTree.HandleCommitPress,
Description: self.c.Tr.Commit,
Tooltip: self.c.Tr.CommitTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChangesWithoutHook),
Keys: opts.GetKeys(opts.Config.Files.CommitChangesWithoutHook),
Handler: self.c.Helpers().WorkingTree.HandleWIPCommitPress,
Description: self.c.Tr.CommitChangesWithoutHook,
},
{
Key: opts.GetKey(opts.Config.Files.AmendLastCommit),
Keys: opts.GetKeys(opts.Config.Files.AmendLastCommit),
Handler: self.handleAmendCommitPress,
Description: self.c.Tr.AmendLastCommit,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChangesWithEditor),
Keys: opts.GetKeys(opts.Config.Files.CommitChangesWithEditor),
Handler: self.c.Helpers().WorkingTree.HandleCommitEditorPress,
Description: self.c.Tr.CommitChangesWithEditor,
},
{
Key: opts.GetKey(opts.Config.Files.FindBaseCommitForFixup),
Keys: opts.GetKeys(opts.Config.Files.FindBaseCommitForFixup),
Handler: self.c.Helpers().FixupHelper.HandleFindBaseCommitForFixupPress,
Description: self.c.Tr.FindBaseCommitForFixup,
Tooltip: self.c.Tr.FindBaseCommitForFixupTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.withItems(self.edit),
GetDisabledReason: self.require(self.withFileTreeViewModelMutex(self.itemsSelected(self.canEditFiles))),
Description: self.c.Tr.Edit,
@ -97,53 +97,53 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.Open,
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Files.IgnoreFile),
Keys: opts.GetKeys(opts.Config.Files.IgnoreFile),
Handler: self.withItem(self.ignoreOrExcludeMenu),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Actions.IgnoreExcludeFile,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.RefreshFiles),
Keys: opts.GetKeys(opts.Config.Files.RefreshFiles),
Handler: self.refresh,
Description: self.c.Tr.RefreshFiles,
},
{
Key: opts.GetKey(opts.Config.Files.StashAllChanges),
Keys: opts.GetKeys(opts.Config.Files.StashAllChanges),
Handler: self.stash,
Description: self.c.Tr.Stash,
Tooltip: self.c.Tr.StashTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.ViewStashOptions),
Keys: opts.GetKeys(opts.Config.Files.ViewStashOptions),
Handler: self.createStashMenu,
Description: self.c.Tr.ViewStashOptions,
Tooltip: self.c.Tr.ViewStashOptionsTooltip,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleStagedAll),
Keys: opts.GetKeys(opts.Config.Files.ToggleStagedAll),
Handler: self.toggleStagedAll,
Description: self.c.Tr.ToggleStagedAll,
Tooltip: self.c.Tr.ToggleStagedAllTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Handler: self.enter,
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.FileEnter,
Tooltip: self.c.Tr.FileEnterTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItems(self.remove),
GetDisabledReason: self.withFileTreeViewModelMutex(self.require(self.itemsSelected(self.canRemove))),
Description: self.c.Tr.Discard,
@ -152,13 +152,13 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Keys: opts.GetKeys(opts.Config.Commits.ViewResetOptions),
Handler: self.createResetToUpstreamMenu,
Description: self.c.Tr.ViewResetToUpstreamOptions,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.ViewResetOptions),
Keys: opts.GetKeys(opts.Config.Files.ViewResetOptions),
Handler: self.createResetMenu,
Description: self.c.Tr.Reset,
Tooltip: self.c.Tr.FileResetOptionsTooltip,
@ -166,19 +166,19 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleTreeView),
Keys: opts.GetKeys(opts.Config.Files.ToggleTreeView),
Handler: self.toggleTreeView,
Description: self.c.Tr.ToggleTreeView,
Tooltip: self.c.Tr.ToggleTreeViewTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Keys: opts.GetKeys(opts.Config.Universal.OpenDiffTool),
Handler: self.withItem(self.openDiffTool),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenDiffTool,
},
{
Key: opts.GetKey(opts.Config.Files.OpenMergeOptions),
Keys: opts.GetKeys(opts.Config.Files.OpenMergeOptions),
Handler: self.withItems(self.openMergeConflictMenu),
Description: self.c.Tr.ViewMergeConflictOptions,
Tooltip: self.c.Tr.ViewMergeConflictOptionsTooltip,
@ -187,20 +187,20 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.Fetch),
Keys: opts.GetKeys(opts.Config.Files.Fetch),
Handler: self.fetch,
Description: self.c.Tr.Fetch,
Tooltip: self.c.Tr.FetchTooltip,
},
{
Key: opts.GetKey(opts.Config.Files.CollapseAll),
Keys: opts.GetKeys(opts.Config.Files.CollapseAll),
Handler: self.collapseAll,
Description: self.c.Tr.CollapseAll,
Tooltip: self.c.Tr.CollapseAllTooltip,
GetDisabledReason: self.require(self.isInTreeMode),
},
{
Key: opts.GetKey(opts.Config.Files.ExpandAll),
Keys: opts.GetKeys(opts.Config.Files.ExpandAll),
Handler: self.expandAll,
Description: self.c.Tr.ExpandAll,
Tooltip: self.c.Tr.ExpandAllTooltip,
@ -671,14 +671,14 @@ func (self *FilesController) handleNonInlineConflict(file *models.File) error {
OnPress: func() error {
return handle(self.c.Git().WorkingTree.StageFile, self.c.Tr.Actions.ResolveConflictByKeepingFile)
},
Key: menuKey('k'),
Keys: menuKey('k'),
}
deleteItem := &types.MenuItem{
Label: self.c.Tr.MergeConflictDeleteFile,
OnPress: func() error {
return handle(self.c.Git().WorkingTree.RemoveConflictedFile, self.c.Tr.Actions.ResolveConflictByDeletingFile)
},
Key: menuKey('d'),
Keys: menuKey('d'),
}
items := []*types.MenuItem{}
switch file.ShortStatus {
@ -856,7 +856,7 @@ func (self *FilesController) ignoreOrExcludeMenu(node *filetree.FileNode) error
}
return nil
},
Key: menuKey('i'),
Keys: menuKey('i'),
},
{
LabelColumns: []string{self.c.Tr.ExcludeFile},
@ -866,7 +866,7 @@ func (self *FilesController) ignoreOrExcludeMenu(node *filetree.FileNode) error
}
return nil
},
Key: menuKey('e'),
Keys: menuKey('e'),
},
},
})
@ -950,7 +950,7 @@ func (self *FilesController) handleStatusFilterPressed() error {
OnPress: func() error {
return self.setStatusFiltering(filetree.DisplayStaged)
},
Key: menuKey('s'),
Keys: menuKey('s'),
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayStaged),
},
{
@ -958,7 +958,7 @@ func (self *FilesController) handleStatusFilterPressed() error {
OnPress: func() error {
return self.setStatusFiltering(filetree.DisplayUnstaged)
},
Key: menuKey('u'),
Keys: menuKey('u'),
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayUnstaged),
},
{
@ -966,7 +966,7 @@ func (self *FilesController) handleStatusFilterPressed() error {
OnPress: func() error {
return self.setStatusFiltering(filetree.DisplayTracked)
},
Key: menuKey('t'),
Keys: menuKey('t'),
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayTracked),
},
{
@ -974,7 +974,7 @@ func (self *FilesController) handleStatusFilterPressed() error {
OnPress: func() error {
return self.setStatusFiltering(filetree.DisplayUntracked)
},
Key: menuKey('T'),
Keys: menuKey('T'),
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayUntracked),
},
{
@ -982,7 +982,7 @@ func (self *FilesController) handleStatusFilterPressed() error {
OnPress: func() error {
return self.setStatusFiltering(filetree.DisplayAll)
},
Key: menuKey('r'),
Keys: menuKey('r'),
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayAll),
},
},
@ -1092,7 +1092,7 @@ func (self *FilesController) createStashMenu() error {
}
return self.handleStashSave(self.c.Git().Stash.Push, self.c.Tr.Actions.StashAllChanges)
},
Key: menuKey('a'),
Keys: menuKey('a'),
},
{
Label: self.c.Tr.StashAllChangesKeepIndex,
@ -1103,14 +1103,14 @@ func (self *FilesController) createStashMenu() error {
// if there are no staged files it behaves the same as Stash.Save
return self.handleStashSave(self.c.Git().Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex)
},
Key: menuKey('i'),
Keys: menuKey('i'),
},
{
Label: self.c.Tr.StashIncludeUntrackedChanges,
OnPress: func() error {
return self.handleStashSave(self.c.Git().Stash.StashIncludeUntrackedChanges, self.c.Tr.Actions.StashIncludeUntrackedChanges)
},
Key: menuKey('U'),
Keys: menuKey('U'),
},
{
Label: self.c.Tr.StashStagedChanges,
@ -1121,7 +1121,7 @@ func (self *FilesController) createStashMenu() error {
}
return self.handleStashSave(self.c.Git().Stash.SaveStagedChanges, self.c.Tr.Actions.StashStagedChanges)
},
Key: menuKey('s'),
Keys: menuKey('s'),
},
{
Label: self.c.Tr.StashUnstagedChanges,
@ -1135,7 +1135,7 @@ func (self *FilesController) createStashMenu() error {
// ordinary stash
return self.handleStashSave(self.c.Git().Stash.Push, self.c.Tr.Actions.StashUnstagedChanges)
},
Key: menuKey('u'),
Keys: menuKey('u'),
},
},
})
@ -1182,7 +1182,7 @@ func (self *FilesController) openCopyMenu() error {
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('n'),
Keys: menuKey('n'),
}
copyRelativePathItem := &types.MenuItem{
Label: self.c.Tr.CopyRelativeFilePath,
@ -1194,7 +1194,7 @@ func (self *FilesController) openCopyMenu() error {
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('p'),
Keys: menuKey('p'),
}
copyAbsolutePathItem := &types.MenuItem{
Label: self.c.Tr.CopyAbsoluteFilePath,
@ -1210,7 +1210,7 @@ func (self *FilesController) openCopyMenu() error {
return nil
},
DisabledReason: self.require(self.singleItemSelected())(),
Key: menuKey('P'),
Keys: menuKey('P'),
}
copyFileDiffItem := &types.MenuItem{
Label: self.c.Tr.CopySelectedDiff,
@ -1236,7 +1236,7 @@ func (self *FilesController) openCopyMenu() error {
return nil
},
))(),
Key: menuKey('s'),
Keys: menuKey('s'),
}
copyAllDiff := &types.MenuItem{
Label: self.c.Tr.CopyAllFilesDiff,
@ -1261,7 +1261,7 @@ func (self *FilesController) openCopyMenu() error {
return nil
},
)(),
Key: menuKey('a'),
Keys: menuKey('a'),
}
return self.c.Menu(types.CreateMenuOptions{
@ -1502,7 +1502,7 @@ func (self *FilesController) remove(selectedNodes []*filetree.FileNode) error {
self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES, types.WORKTREES}})
return nil
},
Key: self.c.KeybindingsOpts().GetKey(self.c.UserConfig().Keybinding.Files.ConfirmDiscard),
Keys: self.c.KeybindingsOpts().GetKeys(self.c.UserConfig().Keybinding.Files.ConfirmDiscard),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.DiscardAllTooltip,
map[string]string{
@ -1528,7 +1528,7 @@ func (self *FilesController) remove(selectedNodes []*filetree.FileNode) error {
self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.FILES, types.WORKTREES}})
return nil
},
Key: menuKey('u'),
Keys: menuKey('u'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.DiscardUnstagedTooltip,
map[string]string{

View file

@ -36,7 +36,7 @@ func (self *FilterController) Context() types.Context {
func (self *FilterController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.StartSearch),
Keys: opts.GetKeys(opts.Config.Universal.StartSearch),
Handler: self.OpenFilterPrompt,
Description: self.c.Tr.StartFilter,
},

View file

@ -35,7 +35,7 @@ func NewGitFlowController(
func (self *GitFlowController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Branches.ViewGitFlowOptions),
Keys: opts.GetKeys(opts.Config.Branches.ViewGitFlowOptions),
Handler: self.withItem(self.handleCreateGitFlowMenu),
Description: self.c.Tr.GitFlowOptions,
OpensMenu: true,
@ -82,22 +82,22 @@ func (self *GitFlowController) handleCreateGitFlowMenu(branch *models.Branch) er
{
Label: "start feature",
OnPress: startHandler("feature"),
Key: menuKey('f'),
Keys: menuKey('f'),
},
{
Label: "start hotfix",
OnPress: startHandler("hotfix"),
Key: menuKey('h'),
Keys: menuKey('h'),
},
{
Label: "start bugfix",
OnPress: startHandler("bugfix"),
Key: menuKey('b'),
Keys: menuKey('b'),
},
{
Label: "start release",
OnPress: startHandler("release"),
Key: menuKey('r'),
Keys: menuKey('r'),
},
},
})

View file

@ -23,20 +23,20 @@ func NewGlobalController(
func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.ExecuteShellCommand),
Keys: opts.GetKeys(opts.Config.Universal.ExecuteShellCommand),
Handler: self.shellCommand,
Description: self.c.Tr.ExecuteShellCommand,
Tooltip: self.c.Tr.ExecuteShellCommandTooltip,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.CreatePatchOptionsMenu),
Keys: opts.GetKeys(opts.Config.Universal.CreatePatchOptionsMenu),
Handler: self.createCustomPatchOptionsMenu,
Description: self.c.Tr.ViewPatchOptions,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.CreateRebaseOptionsMenu),
Keys: opts.GetKeys(opts.Config.Universal.CreateRebaseOptionsMenu),
Handler: opts.Guards.NoPopupPanel(self.c.Helpers().MergeAndRebase.CreateRebaseOptionsMenu),
Description: self.c.Tr.ViewMergeRebaseOptions,
Tooltip: self.c.Tr.ViewMergeRebaseOptionsTooltip,
@ -44,30 +44,30 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
GetDisabledReason: self.canShowRebaseOptions,
},
{
Key: opts.GetKey(opts.Config.Universal.Refresh),
Keys: opts.GetKeys(opts.Config.Universal.Refresh),
Handler: opts.Guards.NoPopupPanel(self.refresh),
Description: self.c.Tr.Refresh,
Tooltip: self.c.Tr.RefreshTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.NextScreenMode),
Keys: opts.GetKeys(opts.Config.Universal.NextScreenMode),
Handler: opts.Guards.NoPopupPanel(self.nextScreenMode),
Description: self.c.Tr.NextScreenMode,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevScreenMode),
Keys: opts.GetKeys(opts.Config.Universal.PrevScreenMode),
Handler: opts.Guards.NoPopupPanel(self.prevScreenMode),
Description: self.c.Tr.PrevScreenMode,
},
{
Key: opts.GetKey(opts.Config.Universal.CyclePagers),
Keys: opts.GetKeys(opts.Config.Universal.CyclePagers),
Handler: opts.Guards.NoPopupPanel(self.cyclePagers),
GetDisabledReason: self.canCyclePagers,
Description: self.c.Tr.CyclePagers,
Tooltip: self.c.Tr.CyclePagersTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.escape,
Description: self.c.Tr.Cancel,
DescriptionFunc: self.escapeDescription,
@ -76,7 +76,7 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.OptionMenu),
Keys: opts.GetKeys(opts.Config.Universal.OptionMenu),
Description: self.c.Tr.OpenKeybindingsMenu,
ShortDescription: self.c.Tr.Keybindings,
Handler: self.createOptionsMenu,
@ -86,41 +86,41 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.FilteringMenu),
Keys: opts.GetKeys(opts.Config.Universal.FilteringMenu),
Handler: opts.Guards.NoPopupPanel(self.createFilteringMenu),
Description: self.c.Tr.OpenFilteringMenu,
Tooltip: self.c.Tr.OpenFilteringMenuTooltip,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.DiffingMenu),
Keys: opts.GetKeys(opts.Config.Universal.DiffingMenu),
Handler: opts.Guards.NoPopupPanel(self.createDiffingMenu),
Description: self.c.Tr.ViewDiffingOptions,
Tooltip: self.c.Tr.ViewDiffingOptionsTooltip,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.DiffingMenuAlt),
Keys: opts.GetKeys(opts.Config.Universal.DiffingMenuAlt),
Handler: opts.Guards.NoPopupPanel(self.createDiffingMenu),
Description: self.c.Tr.ViewDiffingOptions,
Tooltip: self.c.Tr.ViewDiffingOptionsTooltip,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Quit),
Keys: opts.GetKeys(opts.Config.Universal.Quit),
Description: self.c.Tr.Quit,
Handler: self.quit,
},
{
Key: opts.GetKey(opts.Config.Universal.QuitAlt1),
Keys: opts.GetKeys(opts.Config.Universal.QuitAlt1),
Handler: self.quit,
},
{
Key: opts.GetKey(opts.Config.Universal.QuitWithoutChangingDirectory),
Keys: opts.GetKeys(opts.Config.Universal.QuitWithoutChangingDirectory),
Handler: self.quitWithoutChangingDirectory,
},
{
Key: opts.GetKey(opts.Config.Universal.SuspendApp),
Keys: opts.GetKeys(opts.Config.Universal.SuspendApp),
Handler: self.c.Helpers().SuspendResume.SuspendApp,
Description: self.c.Tr.SuspendApp,
GetDisabledReason: func() *types.DisabledReason {
@ -133,7 +133,7 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
},
},
{
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
Keys: opts.GetKeys(opts.Config.Universal.ToggleWhitespaceInDiffView),
Handler: self.toggleWhitespace,
Description: self.c.Tr.ToggleWhitespaceInDiffView,
Tooltip: self.c.Tr.ToggleWhitespaceInDiffViewTooltip,

View file

@ -228,7 +228,7 @@ func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.S
OnPress: func() error {
return self.SwitchToEditor()
},
Key: menuKey('e'),
Keys: menuKey('e'),
DisabledReason: disabledReasonForOpenInEditor,
},
{
@ -236,14 +236,14 @@ func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.S
OnPress: func() error {
return self.addCoAuthor(suggestionFunc)
},
Key: menuKey('c'),
Keys: menuKey('c'),
},
{
Label: self.c.Tr.PasteCommitMessageFromClipboard,
OnPress: func() error {
return self.pasteCommitMessageFromClipboard()
},
Key: menuKey('p'),
Keys: menuKey('p'),
},
}
return self.c.Menu(types.CreateMenuOptions{

View file

@ -39,17 +39,17 @@ const (
func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error {
type optionAndKey struct {
option string
key []gocui.Key
keys []gocui.Key
}
options := []optionAndKey{
{option: REBASE_OPTION_CONTINUE, key: menuKey('c')},
{option: REBASE_OPTION_ABORT, key: menuKey('a')},
{option: REBASE_OPTION_CONTINUE, keys: menuKey('c')},
{option: REBASE_OPTION_ABORT, keys: menuKey('a')},
}
if self.c.Git().Status.WorkingTreeState().CanSkip() {
options = append(options, optionAndKey{
option: REBASE_OPTION_SKIP, key: menuKey('s'),
option: REBASE_OPTION_SKIP, keys: menuKey('s'),
})
}
@ -59,7 +59,7 @@ func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error {
OnPress: func() error {
return self.genericMergeCommand(row.option)
},
Key: row.key,
Keys: row.keys,
}
})
@ -198,7 +198,7 @@ func (self *MergeAndRebaseHelper) PromptForConflictHandling() error {
OnPress: func() error {
return self.genericMergeCommand(REBASE_OPTION_ABORT)
},
Key: menuKey('a'),
Keys: menuKey('a'),
},
},
HideCancel: true,
@ -284,7 +284,7 @@ func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error {
Label: utils.ResolvePlaceholderString(self.c.Tr.SimpleRebase,
map[string]string{"ref": ref},
),
Key: menuKey('s'),
Keys: menuKey('s'),
DisabledReason: disabledReason,
OnPress: func() error {
self.c.LogAction(self.c.Tr.Actions.RebaseBranch)
@ -308,7 +308,7 @@ func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error {
Label: utils.ResolvePlaceholderString(self.c.Tr.InteractiveRebase,
map[string]string{"ref": ref},
),
Key: menuKey('i'),
Keys: menuKey('i'),
DisabledReason: disabledReason,
Tooltip: self.c.Tr.InteractiveRebaseTooltip,
OnPress: func() error {
@ -334,7 +334,7 @@ func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error {
Label: utils.ResolvePlaceholderString(self.c.Tr.RebaseOntoBaseBranch,
map[string]string{"baseBranch": ShortBranchName(baseBranch)},
),
Key: menuKey('b'),
Keys: menuKey('b'),
DisabledReason: baseBranchDisabledReason,
Tooltip: self.c.Tr.RebaseOntoBaseBranchTooltip,
OnPress: func() error {
@ -392,7 +392,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
firstRegularMergeItem = &types.MenuItem{
Label: self.c.Tr.RegularMergeFastForward,
OnPress: self.RegularMerge(refName, git_commands.MERGE_VARIANT_REGULAR),
Key: menuKey('m'),
Keys: menuKey('m'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.RegularMergeFastForwardTooltip,
map[string]string{
@ -406,7 +406,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
secondRegularMergeItem = &types.MenuItem{
Label: self.c.Tr.RegularMergeNonFastForward,
OnPress: self.RegularMerge(refName, git_commands.MERGE_VARIANT_NON_FAST_FORWARD),
Key: menuKey('n'),
Keys: menuKey('n'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.RegularMergeNonFastForwardTooltip,
map[string]string{
@ -419,7 +419,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
firstRegularMergeItem = &types.MenuItem{
Label: self.c.Tr.RegularMergeNonFastForward,
OnPress: self.RegularMerge(refName, git_commands.MERGE_VARIANT_REGULAR),
Key: menuKey('m'),
Keys: menuKey('m'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.RegularMergeNonFastForwardTooltip,
map[string]string{
@ -432,7 +432,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
secondRegularMergeItem = &types.MenuItem{
Label: self.c.Tr.RegularMergeFastForward,
OnPress: self.RegularMerge(refName, git_commands.MERGE_VARIANT_FAST_FORWARD),
Key: menuKey('f'),
Keys: menuKey('f'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.RegularMergeFastForwardTooltip,
map[string]string{
@ -464,7 +464,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
{
Label: self.c.Tr.SquashMergeUncommitted,
OnPress: self.SquashMergeUncommitted(refName),
Key: menuKey('s'),
Keys: menuKey('s'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.SquashMergeUncommittedTooltip,
map[string]string{
@ -475,7 +475,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
{
Label: self.c.Tr.SquashMergeCommitted,
OnPress: self.SquashMergeCommitted(refName, checkedOutBranchName),
Key: menuKey('S'),
Keys: menuKey('S'),
Tooltip: utils.ResolvePlaceholderString(
self.c.Tr.SquashMergeCommittedTooltip,
map[string]string{

View file

@ -216,15 +216,15 @@ func (self *RefsHelper) ResetToRef(ref string, strength string, envVars []string
func (self *RefsHelper) CreateSortOrderMenu(sortOptionsOrder []string, menuPrompt string, onSelected func(sortOrder string) error, currentValue string) error {
type sortMenuOption struct {
key []gocui.Key
keys []gocui.Key
label string
description string
sortOrder string
}
availableSortOptions := map[string]sortMenuOption{
"recency": {label: self.c.Tr.SortByRecency, description: self.c.Tr.SortBasedOnReflog, key: menuKey('r')},
"alphabetical": {label: self.c.Tr.SortAlphabetical, description: "--sort=refname", key: menuKey('a')},
"date": {label: self.c.Tr.SortByDate, description: "--sort=-committerdate", key: menuKey('d')},
"recency": {label: self.c.Tr.SortByRecency, description: self.c.Tr.SortBasedOnReflog, keys: menuKey('r')},
"alphabetical": {label: self.c.Tr.SortAlphabetical, description: "--sort=refname", keys: menuKey('a')},
"date": {label: self.c.Tr.SortByDate, description: "--sort=-committerdate", keys: menuKey('d')},
}
sortOptions := make([]sortMenuOption, 0, len(sortOptionsOrder))
for _, key := range sortOptionsOrder {
@ -245,7 +245,7 @@ func (self *RefsHelper) CreateSortOrderMenu(sortOptionsOrder []string, menuPromp
OnPress: func() error {
return onSelected(opt.sortOrder)
},
Key: opt.key,
Keys: opt.keys,
Widget: types.MakeMenuRadioButton(opt.sortOrder == currentValue),
}
})
@ -260,14 +260,14 @@ func (self *RefsHelper) CreateGitResetMenu(name string, ref string) error {
type strengthWithKey struct {
strength string
label string
key []gocui.Key
keys []gocui.Key
tooltip string
}
strengths := []strengthWithKey{
// not i18'ing because it's git terminology
{strength: "mixed", label: "Mixed reset", key: menuKey('m'), tooltip: self.c.Tr.ResetMixedTooltip},
{strength: "soft", label: "Soft reset", key: menuKey('s'), tooltip: self.c.Tr.ResetSoftTooltip},
{strength: "hard", label: "Hard reset", key: menuKey('h'), tooltip: self.c.Tr.ResetHardTooltip},
{strength: "mixed", label: "Mixed reset", keys: menuKey('m'), tooltip: self.c.Tr.ResetMixedTooltip},
{strength: "soft", label: "Soft reset", keys: menuKey('s'), tooltip: self.c.Tr.ResetSoftTooltip},
{strength: "hard", label: "Hard reset", keys: menuKey('h'), tooltip: self.c.Tr.ResetHardTooltip},
}
menuItems := lo.Map(strengths, func(row strengthWithKey, _ int) *types.MenuItem {
@ -287,7 +287,7 @@ func (self *RefsHelper) CreateGitResetMenu(name string, ref string) error {
},
})
},
Key: row.key,
Keys: row.keys,
Tooltip: row.tooltip,
}
})
@ -312,15 +312,15 @@ func (self *RefsHelper) CreateCheckoutMenu(commit *models.Commit) error {
self.c.LogAction(self.c.Tr.Actions.CheckoutCommit)
return self.CheckoutRef(hash, types.CheckoutRefOptions{})
},
Key: menuKey('d'),
Keys: menuKey('d'),
},
}
if len(branches) > 0 {
menuItems = append(menuItems, lo.Map(branches, func(branch *models.Branch, index int) *types.MenuItem {
var key []gocui.Key
var keys []gocui.Key
if index < 9 {
key = menuKey(rune(index + 1 + '0')) // Convert 1-based index to key
keys = menuKey(rune(index + 1 + '0')) // Convert 1-based index to key
}
return &types.MenuItem{
LabelColumns: []string{fmt.Sprintf(self.c.Tr.Actions.CheckoutBranchAtCommit, branch.Name)},
@ -328,7 +328,7 @@ func (self *RefsHelper) CreateCheckoutMenu(commit *models.Commit) error {
self.c.LogAction(self.c.Tr.Actions.CheckoutBranch)
return self.CheckoutRef(branch.RefName(), types.CheckoutRefOptions{})
},
Key: key,
Keys: keys,
}
})...)
} else {
@ -336,7 +336,7 @@ func (self *RefsHelper) CreateCheckoutMenu(commit *models.Commit) error {
LabelColumns: []string{self.c.Tr.Actions.CheckoutBranch},
OnPress: func() error { return nil },
DisabledReason: &types.DisabledReason{Text: self.c.Tr.NoBranchesFoundAtCommitTooltip},
Key: menuKey('1'),
Keys: menuKey('1'),
})
}

View file

@ -382,7 +382,7 @@ func (self *WorkingTreeHelper) CreateMergeConflictMenu(selectedFilepaths []strin
OnPress: func() error {
return onMergeStrategySelected("--ours")
},
Key: menuKey('c'),
Keys: menuKey('c'),
},
{
LabelColumns: []string{
@ -392,7 +392,7 @@ func (self *WorkingTreeHelper) CreateMergeConflictMenu(selectedFilepaths []strin
OnPress: func() error {
return onMergeStrategySelected("--theirs")
},
Key: menuKey('i'),
Keys: menuKey('i'),
},
{
LabelColumns: []string{
@ -402,7 +402,7 @@ func (self *WorkingTreeHelper) CreateMergeConflictMenu(selectedFilepaths []strin
OnPress: func() error {
return onMergeStrategySelected("--union")
},
Key: menuKey('b'),
Keys: menuKey('b'),
},
{
LabelColumns: []string{
@ -410,7 +410,7 @@ func (self *WorkingTreeHelper) CreateMergeConflictMenu(selectedFilepaths []strin
cmdColor.Sprint("git mergetool"),
},
OnPress: self.OpenMergeTool,
Key: menuKey('m'),
Keys: menuKey('m'),
},
},
})

View file

@ -39,7 +39,7 @@ func (self *JumpToSideWindowController) GetKeybindings(opts types.KeybindingsOpt
return &types.Binding{
ViewName: "",
// by default the keys are 1, 2, 3, etc
Key: opts.GetKey(opts.Config.Universal.JumpToBlock[index]),
Keys: opts.GetKeys(opts.Config.Universal.JumpToBlock[index]),
Handler: opts.Guards.NoPopupPanel(self.goToSideWindow(window)),
}
})

View file

@ -271,26 +271,26 @@ func (self *ListController) isFocused() bool {
func (self *ListController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevItemAlt), Handler: self.HandlePrevLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevItem), Handler: self.HandlePrevLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextItemAlt), Handler: self.HandleNextLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextItem), Handler: self.HandleNextLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevPage), Handler: self.HandlePrevPage, Description: self.c.Tr.PrevPage},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextPage), Handler: self.HandleNextPage, Description: self.c.Tr.NextPage},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoTop), Handler: self.HandleGotoTop, Description: self.c.Tr.GotoTop, Alternative: "<home>"},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoBottom), Handler: self.HandleGotoBottom, Description: self.c.Tr.GotoBottom, Alternative: "<end>"},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoTopAlt), Handler: self.HandleGotoTop},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt), Handler: self.HandleGotoBottom},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ScrollLeft), Handler: self.HandleScrollLeft},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ScrollRight), Handler: self.HandleScrollRight},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.PrevItemAlt), Handler: self.HandlePrevLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.PrevItem), Handler: self.HandlePrevLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.NextItemAlt), Handler: self.HandleNextLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.NextItem), Handler: self.HandleNextLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.PrevPage), Handler: self.HandlePrevPage, Description: self.c.Tr.PrevPage},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.NextPage), Handler: self.HandleNextPage, Description: self.c.Tr.NextPage},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoTop), Handler: self.HandleGotoTop, Description: self.c.Tr.GotoTop, Alternative: "<home>"},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoBottom), Handler: self.HandleGotoBottom, Description: self.c.Tr.GotoBottom, Alternative: "<end>"},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoTopAlt), Handler: self.HandleGotoTop},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoBottomAlt), Handler: self.HandleGotoBottom},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.ScrollLeft), Handler: self.HandleScrollLeft},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.ScrollRight), Handler: self.HandleScrollRight},
}
if self.context.RangeSelectEnabled() {
bindings = append(bindings,
[]*types.Binding{
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.ToggleRangeSelect), Handler: self.HandleToggleRangeSelect, Description: self.c.Tr.ToggleRangeSelect},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.RangeSelectDown), Handler: self.HandleRangeSelectDown, Description: self.c.Tr.RangeSelectDown},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.RangeSelectUp), Handler: self.HandleRangeSelectUp, Description: self.c.Tr.RangeSelectUp},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.ToggleRangeSelect), Handler: self.HandleToggleRangeSelect, Description: self.c.Tr.ToggleRangeSelect},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.RangeSelectDown), Handler: self.HandleRangeSelectDown, Description: self.c.Tr.RangeSelectDown},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.RangeSelectUp), Handler: self.HandleRangeSelectUp, Description: self.c.Tr.RangeSelectUp},
}...,
)
}

View file

@ -56,7 +56,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Commits.SquashDown),
Keys: opts.GetKeys(opts.Config.Commits.SquashDown),
Handler: opts.Guards.OutsideFilterMode(self.withItemsRange(self.squashDown)),
GetDisabledReason: self.require(
self.itemRangeSelected(
@ -69,7 +69,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.MarkCommitAsFixup),
Keys: opts.GetKeys(opts.Config.Commits.MarkCommitAsFixup),
Handler: opts.Guards.OutsideFilterMode(self.withItemsRange(self.fixup)),
GetDisabledReason: self.require(
self.itemRangeSelected(
@ -82,7 +82,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.SetFixupMessage),
Keys: opts.GetKeys(opts.Config.Commits.SetFixupMessage),
Handler: self.withItem(self.setFixupMessage),
GetDisabledReason: self.require(
self.singleItemSelected(self.canSetFixupMessage),
@ -91,7 +91,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Tooltip: self.c.Tr.SetFixupMessageTooltip,
},
{
Key: opts.GetKey(opts.Config.Commits.RenameCommit),
Keys: opts.GetKeys(opts.Config.Commits.RenameCommit),
Handler: self.withItem(self.reword),
GetDisabledReason: self.require(
self.singleItemSelected(self.rewordEnabled),
@ -102,7 +102,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.RenameCommitWithEditor),
Keys: opts.GetKeys(opts.Config.Commits.RenameCommitWithEditor),
Handler: self.withItem(self.rewordEditor),
GetDisabledReason: self.require(
self.singleItemSelected(self.rewordEnabled),
@ -110,7 +110,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Description: self.c.Tr.RewordCommitEditor,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItemsRange(self.drop),
GetDisabledReason: self.require(
self.itemRangeSelected(
@ -122,7 +122,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(editCommitKey),
Keys: opts.GetKeys(editCommitKey),
Handler: opts.Guards.OutsideFilterMode(self.withItemsRange(self.edit)),
GetDisabledReason: self.require(
self.itemRangeSelected(self.midRebaseCommandEnabled),
@ -136,7 +136,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
// The user-facing description here is 'Start interactive rebase' but internally
// we're calling it 'quick-start interactive rebase' to differentiate it from
// when you manually select the base commit.
Key: opts.GetKey(opts.Config.Commits.StartInteractiveRebase),
Keys: opts.GetKeys(opts.Config.Commits.StartInteractiveRebase),
Handler: opts.Guards.OutsideFilterMode(self.quickStartInteractiveRebase),
GetDisabledReason: self.require(self.notMidRebase(self.c.Tr.AlreadyRebasing), self.canFindCommitForQuickStart),
Description: self.c.Tr.QuickStartInteractiveRebase,
@ -145,7 +145,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
}),
},
{
Key: opts.GetKey(opts.Config.Commits.PickCommit),
Keys: opts.GetKeys(opts.Config.Commits.PickCommit),
Handler: opts.Guards.OutsideFilterMode(self.withItems(self.pick)),
GetDisabledReason: self.require(
self.itemRangeSelected(self.pickEnabled),
@ -154,7 +154,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Tooltip: self.c.Tr.PickCommitTooltip,
},
{
Key: opts.GetKey(opts.Config.Commits.CreateFixupCommit),
Keys: opts.GetKeys(opts.Config.Commits.CreateFixupCommit),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.createFixupCommit)),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.CreateFixupCommit,
@ -166,7 +166,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
),
},
{
Key: opts.GetKey(opts.Config.Commits.SquashAboveCommits),
Keys: opts.GetKeys(opts.Config.Commits.SquashAboveCommits),
Handler: opts.Guards.OutsideFilterMode(self.squashFixupCommits),
GetDisabledReason: self.require(
self.notMidRebase(self.c.Tr.AlreadyRebasing),
@ -176,7 +176,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.MoveDownCommit),
Keys: opts.GetKeys(opts.Config.Commits.MoveDownCommit),
Handler: opts.Guards.OutsideFilterMode(self.withItemsRange(self.moveDown)),
GetDisabledReason: self.require(self.itemRangeSelected(
self.midRebaseMoveCommandEnabled,
@ -185,7 +185,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Description: self.c.Tr.MoveDownCommit,
},
{
Key: opts.GetKey(opts.Config.Commits.MoveUpCommit),
Keys: opts.GetKeys(opts.Config.Commits.MoveUpCommit),
Handler: opts.Guards.OutsideFilterMode(self.withItemsRange(self.moveUp)),
GetDisabledReason: self.require(self.itemRangeSelected(
self.midRebaseMoveCommandEnabled,
@ -194,14 +194,14 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Description: self.c.Tr.MoveUpCommit,
},
{
Key: opts.GetKey(opts.Config.Commits.PasteCommits),
Keys: opts.GetKeys(opts.Config.Commits.PasteCommits),
Handler: opts.Guards.OutsideFilterMode(self.paste),
GetDisabledReason: self.require(self.canPaste),
Description: self.c.Tr.PasteCommits,
DisplayStyle: &style.FgCyan,
},
{
Key: opts.GetKey(opts.Config.Commits.MarkCommitAsBaseForRebase),
Keys: opts.GetKeys(opts.Config.Commits.MarkCommitAsBaseForRebase),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.markAsBaseCommit)),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.MarkAsBaseCommit,
@ -210,13 +210,13 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
// overriding this navigation keybinding because we might need to load
// more commits on demand
{
Key: opts.GetKey(opts.Config.Universal.StartSearch),
Keys: opts.GetKeys(opts.Config.Universal.StartSearch),
Handler: self.openSearch,
Description: self.c.Tr.StartSearch,
Tag: "navigation",
},
{
Key: opts.GetKey(opts.Config.Commits.AmendToCommit),
Keys: opts.GetKeys(opts.Config.Commits.AmendToCommit),
Handler: self.withItem(self.amendTo),
GetDisabledReason: self.require(self.singleItemSelected(self.canAmend)),
Description: self.c.Tr.Amend,
@ -224,7 +224,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ResetCommitAuthor),
Keys: opts.GetKeys(opts.Config.Commits.ResetCommitAuthor),
Handler: self.withItemsRange(self.amendAttribute),
GetDisabledReason: self.require(self.itemRangeSelected(self.canAmendRange)),
Description: self.c.Tr.AmendCommitAttribute,
@ -232,28 +232,28 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.RevertCommit),
Keys: opts.GetKeys(opts.Config.Commits.RevertCommit),
Handler: self.withItemsRange(self.revert),
GetDisabledReason: self.require(self.itemRangeSelected()),
Description: self.c.Tr.Revert,
Tooltip: self.c.Tr.RevertCommitTooltip,
},
{
Key: opts.GetKey(opts.Config.Commits.CreateTag),
Keys: opts.GetKeys(opts.Config.Commits.CreateTag),
Handler: self.withItem(self.createTag),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.TagCommit,
Tooltip: self.c.Tr.TagCommitTooltip,
},
{
Key: opts.GetKey(opts.Config.Commits.OpenLogMenu),
Keys: opts.GetKeys(opts.Config.Commits.OpenLogMenu),
Handler: self.handleOpenLogMenu,
Description: self.c.Tr.OpenLogMenu,
Tooltip: self.c.Tr.OpenLogMenuTooltip,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.OpenPullRequestInBrowser),
Keys: opts.GetKeys(opts.Config.Commits.OpenPullRequestInBrowser),
Handler: self.openPRInBrowser,
GetDisabledReason: self.checkedOutBranchHasPR,
Description: self.c.Tr.OpenPullRequestInBrowser,
@ -361,7 +361,7 @@ func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, star
Items: []*types.MenuItem{
{
Label: self.c.Tr.Fixup,
Key: menuKey('f'),
Keys: menuKey('f'),
OnPress: func() error {
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.FixupCommit)
@ -372,7 +372,7 @@ func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, star
},
{
Label: self.c.Tr.FixupKeepMessage,
Key: menuKey('c'),
Keys: menuKey('c'),
OnPress: func() error {
return self.c.WithWaitingStatus(self.c.Tr.FixingStatus, func(gocui.Task) error {
self.c.LogAction(self.c.Tr.Actions.FixupCommitKeepMessage)
@ -403,7 +403,7 @@ func (self *LocalCommitsController) setFixupMessage(commit *models.Commit) error
Items: []*types.MenuItem{
{
Label: self.c.Tr.FixupDiscardMessage,
Key: menuKey('f'),
Keys: menuKey('f'),
OnPress: func() error {
return self.updateTodosWithFlag(todo.Fixup, []*models.Commit{commit}, "")
},
@ -411,7 +411,7 @@ func (self *LocalCommitsController) setFixupMessage(commit *models.Commit) error
},
{
Label: self.c.Tr.FixupKeepMessage,
Key: menuKey('c'),
Keys: menuKey('c'),
OnPress: func() error {
return self.updateTodosWithFlag(todo.Fixup, []*models.Commit{commit}, "-C")
},
@ -864,19 +864,19 @@ func (self *LocalCommitsController) amendAttribute(commits []*models.Commit, sta
{
Label: self.c.Tr.ResetAuthor,
OnPress: func() error { return self.resetAuthor(start, end) },
Key: opts.GetKey(opts.Config.AmendAttribute.ResetAuthor),
Keys: opts.GetKeys(opts.Config.AmendAttribute.ResetAuthor),
Tooltip: self.c.Tr.ResetAuthorTooltip,
},
{
Label: self.c.Tr.SetAuthor,
OnPress: func() error { return self.setAuthor(start, end) },
Key: opts.GetKey(opts.Config.AmendAttribute.SetAuthor),
Keys: opts.GetKeys(opts.Config.AmendAttribute.SetAuthor),
Tooltip: self.c.Tr.SetAuthorTooltip,
},
{
Label: self.c.Tr.AddCoAuthor,
OnPress: func() error { return self.addCoAuthor(start, end) },
Key: opts.GetKey(opts.Config.AmendAttribute.AddCoAuthor),
Keys: opts.GetKeys(opts.Config.AmendAttribute.AddCoAuthor),
Tooltip: self.c.Tr.AddCoAuthorTooltip,
},
},
@ -1000,7 +1000,7 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err
Items: []*types.MenuItem{
{
Label: self.c.Tr.FixupMenu_Fixup,
Key: menuKey('f'),
Keys: menuKey('f'),
OnPress: func() error {
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
self.c.LogAction(self.c.Tr.Actions.CreateFixupCommit)
@ -1024,7 +1024,7 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err
},
{
Label: self.c.Tr.FixupMenu_AmendWithChanges,
Key: menuKey('a'),
Keys: menuKey('a'),
OnPress: func() error {
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
return self.createAmendCommit(commit, true)
@ -1035,7 +1035,7 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err
},
{
Label: self.c.Tr.FixupMenu_AmendWithoutChanges,
Key: menuKey('r'),
Keys: menuKey('r'),
OnPress: func() error { return self.createAmendCommit(commit, false) },
Tooltip: self.c.Tr.FixupMenu_AmendWithoutChangesTooltip,
},
@ -1134,14 +1134,14 @@ func (self *LocalCommitsController) squashFixupCommits() error {
Label: self.c.Tr.SquashCommitsInCurrentBranch,
OnPress: self.squashAllFixupsInCurrentBranch,
DisabledReason: self.canFindCommitForSquashFixupsInCurrentBranch(),
Key: menuKey('b'),
Keys: menuKey('b'),
Tooltip: self.c.Tr.SquashCommitsInCurrentBranchTooltip,
},
{
Label: self.c.Tr.SquashCommitsAboveSelectedCommit,
OnPress: self.withItem(self.squashAllFixupsAboveSelectedCommit),
DisabledReason: self.singleItemSelected()(),
Key: menuKey('a'),
Keys: menuKey('a'),
Tooltip: self.c.Tr.SquashCommitsAboveSelectedTooltip,
},
},

View file

@ -32,21 +32,21 @@ func NewMainViewController(
func (self *MainViewController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
Handler: self.togglePanel,
Description: self.c.Tr.ToggleStagingView,
Tooltip: self.c.Tr.ToggleStagingViewTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.escape,
Description: self.c.Tr.ExitFocusedMainView,
DisplayOnScreen: true,
},
{
// overriding this because we want to read all of the task's output before we start searching
Key: opts.GetKey(opts.Config.Universal.StartSearch),
Keys: opts.GetKeys(opts.Config.Universal.StartSearch),
Handler: self.openSearch,
Description: self.c.Tr.StartSearch,
Tag: "navigation",

View file

@ -33,19 +33,19 @@ func NewMenuController(
func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.press),
GetDisabledReason: self.require(self.singleItemSelected()),
},
{
Key: opts.GetKey(opts.Config.Universal.ConfirmMenu),
Keys: opts.GetKeys(opts.Config.Universal.ConfirmMenu),
Handler: self.withItem(self.press),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Execute,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.close,
Description: self.c.Tr.CloseCancel,
DisplayOnScreen: true,

View file

@ -28,91 +28,91 @@ func NewMergeConflictsController(
func (self *MergeConflictsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withRenderAndFocus(self.HandlePickHunk),
Description: self.c.Tr.PickHunk,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Main.PickBothHunks),
Keys: opts.GetKeys(opts.Config.Main.PickBothHunks),
Handler: self.withRenderAndFocus(self.HandlePickAllHunks),
Description: self.c.Tr.PickAllHunks,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: self.withRenderAndFocus(self.PrevConflictHunk),
Description: self.c.Tr.SelectPrevHunk,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: self.withRenderAndFocus(self.NextConflictHunk),
Description: self.c.Tr.SelectNextHunk,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
Keys: opts.GetKeys(opts.Config.Universal.PrevBlock),
Handler: self.withRenderAndFocus(self.PrevConflict),
Description: self.c.Tr.PrevConflict,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.NextBlock),
Keys: opts.GetKeys(opts.Config.Universal.NextBlock),
Handler: self.withRenderAndFocus(self.NextConflict),
Description: self.c.Tr.NextConflict,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Undo),
Keys: opts.GetKeys(opts.Config.Universal.Undo),
Handler: self.withRenderAndFocus(self.HandleUndo),
Description: self.c.Tr.Undo,
Tooltip: self.c.Tr.UndoMergeResolveTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.HandleEditFile,
Description: self.c.Tr.EditFile,
Tooltip: self.c.Tr.EditFileTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.HandleOpenFile,
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt),
Keys: opts.GetKeys(opts.Config.Universal.PrevBlockAlt),
Handler: self.withRenderAndFocus(self.PrevConflict),
},
{
Key: opts.GetKey(opts.Config.Universal.NextBlockAlt),
Keys: opts.GetKeys(opts.Config.Universal.NextBlockAlt),
Handler: self.withRenderAndFocus(self.NextConflict),
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.PrevItemAlt),
Handler: self.withRenderAndFocus(self.PrevConflictHunk),
},
{
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.NextItemAlt),
Handler: self.withRenderAndFocus(self.NextConflictHunk),
},
{
Key: opts.GetKey(opts.Config.Universal.ScrollLeft),
Keys: opts.GetKeys(opts.Config.Universal.ScrollLeft),
Handler: self.withRenderAndFocus(self.HandleScrollLeft),
Description: self.c.Tr.ScrollLeft,
Tag: "navigation",
},
{
Key: opts.GetKey(opts.Config.Universal.ScrollRight),
Keys: opts.GetKeys(opts.Config.Universal.ScrollRight),
Handler: self.withRenderAndFocus(self.HandleScrollRight),
Description: self.c.Tr.ScrollRight,
Tag: "navigation",
},
{
Key: opts.GetKey(opts.Config.Files.OpenMergeOptions),
Keys: opts.GetKeys(opts.Config.Files.OpenMergeOptions),
Handler: self.openMergeConflictMenu,
Description: self.c.Tr.ViewMergeConflictOptions,
Tooltip: self.c.Tr.ViewMergeConflictOptionsTooltip,
@ -120,7 +120,7 @@ func (self *MergeConflictsController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.Escape,
Description: self.c.Tr.ReturnToFilesPanel,
},

View file

@ -33,7 +33,7 @@ func (self *OptionsMenuAction) Call() error {
return self.c.IGuiCommon.CallKeybindingHandler(binding)
},
Key: binding.Key,
Keys: binding.Keys,
Tooltip: binding.Tooltip,
DisabledReason: disabledReason,
Section: section,

View file

@ -27,25 +27,25 @@ func NewPatchBuildingController(
func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.OpenFile,
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.EditFile,
Description: self.c.Tr.EditFile,
Tooltip: self.c.Tr.EditFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.ToggleSelectionAndRefresh,
Description: self.c.Tr.ToggleSelectionForPatch,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.discardSelection,
GetDisabledReason: self.getDisabledReasonForDiscard,
Description: self.c.Tr.RemoveSelectionFromPatch,
@ -53,7 +53,7 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.Escape,
Description: self.c.Tr.ExitCustomPatchBuilder,
DescriptionFunc: self.EscapeDescription,

View file

@ -41,61 +41,61 @@ func (self *PatchExplorerController) GetKeybindings(opts types.KeybindingsOpts)
return []*types.Binding{
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.PrevItemAlt),
Handler: self.withRenderAndFocus(self.HandlePrevLine),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: self.withRenderAndFocus(self.HandlePrevLine),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.NextItemAlt),
Handler: self.withRenderAndFocus(self.HandleNextLine),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: self.withRenderAndFocus(self.HandleNextLine),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.RangeSelectUp),
Keys: opts.GetKeys(opts.Config.Universal.RangeSelectUp),
Handler: self.withRenderAndFocus(self.HandlePrevLineRange),
Description: self.c.Tr.RangeSelectUp,
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.RangeSelectDown),
Keys: opts.GetKeys(opts.Config.Universal.RangeSelectDown),
Handler: self.withRenderAndFocus(self.HandleNextLineRange),
Description: self.c.Tr.RangeSelectDown,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
Keys: opts.GetKeys(opts.Config.Universal.PrevBlock),
Handler: self.withRenderAndFocus(self.HandlePrevHunk),
Description: self.c.Tr.PrevHunk,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt),
Keys: opts.GetKeys(opts.Config.Universal.PrevBlockAlt),
Handler: self.withRenderAndFocus(self.HandlePrevHunk),
},
{
Key: opts.GetKey(opts.Config.Universal.NextBlock),
Keys: opts.GetKeys(opts.Config.Universal.NextBlock),
Handler: self.withRenderAndFocus(self.HandleNextHunk),
Description: self.c.Tr.NextHunk,
},
{
Key: opts.GetKey(opts.Config.Universal.NextBlockAlt),
Keys: opts.GetKeys(opts.Config.Universal.NextBlockAlt),
Handler: self.withRenderAndFocus(self.HandleNextHunk),
},
{
Key: opts.GetKey(opts.Config.Universal.ToggleRangeSelect),
Keys: opts.GetKeys(opts.Config.Universal.ToggleRangeSelect),
Handler: self.withRenderAndFocus(self.HandleToggleSelectRange),
Description: self.c.Tr.ToggleRangeSelect,
},
{
Key: opts.GetKey(opts.Config.Main.ToggleSelectHunk),
Keys: opts.GetKeys(opts.Config.Main.ToggleSelectHunk),
Handler: self.withRenderAndFocus(self.HandleToggleSelectHunk),
Description: self.c.Tr.ToggleSelectHunk,
DescriptionFunc: func() string {
@ -109,50 +109,50 @@ func (self *PatchExplorerController) GetKeybindings(opts types.KeybindingsOpts)
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevPage),
Keys: opts.GetKeys(opts.Config.Universal.PrevPage),
Handler: self.withRenderAndFocus(self.HandlePrevPage),
Description: self.c.Tr.PrevPage,
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextPage),
Keys: opts.GetKeys(opts.Config.Universal.NextPage),
Handler: self.withRenderAndFocus(self.HandleNextPage),
Description: self.c.Tr.NextPage,
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.GotoTop),
Keys: opts.GetKeys(opts.Config.Universal.GotoTop),
Handler: self.withRenderAndFocus(self.HandleGotoTop),
Description: self.c.Tr.GotoTop,
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.GotoBottom),
Keys: opts.GetKeys(opts.Config.Universal.GotoBottom),
Description: self.c.Tr.GotoBottom,
Handler: self.withRenderAndFocus(self.HandleGotoBottom),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
Keys: opts.GetKeys(opts.Config.Universal.GotoTopAlt),
Handler: self.withRenderAndFocus(self.HandleGotoTop),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
Keys: opts.GetKeys(opts.Config.Universal.GotoBottomAlt),
Handler: self.withRenderAndFocus(self.HandleGotoBottom),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.ScrollLeft),
Keys: opts.GetKeys(opts.Config.Universal.ScrollLeft),
Handler: self.withRenderAndFocus(self.HandleScrollLeft),
},
{
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.ScrollRight),
Keys: opts.GetKeys(opts.Config.Universal.ScrollRight),
Handler: self.withRenderAndFocus(self.HandleScrollRight),
},
{
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: self.withLock(self.CopySelectedToClipboard),
Description: self.c.Tr.CopySelectedTextToClipboard,
},

View file

@ -27,19 +27,19 @@ func NewPromptController(
func (self *PromptController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: []gocui.Key{gocui.NewKeyName(gocui.KeyEnter)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.KeyEnter)},
Handler: func() error { return self.context().State.OnConfirm() },
Description: self.c.Tr.Confirm,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: func() error { return self.context().State.OnClose() },
Description: self.c.Tr.CloseCancel,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
Handler: func() error {
if len(self.c.Contexts().Suggestions.State.Suggestions) > 0 {
self.switchToSuggestions()

View file

@ -35,7 +35,7 @@ func NewRemoteBranchesController(
func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.checkoutBranch),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Checkout,
@ -43,13 +43,13 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.withItem(self.newLocalBranch),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.NewBranch,
},
{
Key: opts.GetKey(opts.Config.Branches.MergeIntoCurrentBranch),
Keys: opts.GetKeys(opts.Config.Branches.MergeIntoCurrentBranch),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.merge)),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Merge,
@ -57,7 +57,7 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.RebaseBranch),
Keys: opts.GetKeys(opts.Config.Branches.RebaseBranch),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.rebase)),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.RebaseBranch,
@ -65,7 +65,7 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItems(self.delete),
GetDisabledReason: self.require(self.itemRangeSelected()),
Description: self.c.Tr.Delete,
@ -73,7 +73,7 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.SetUpstream),
Keys: opts.GetKeys(opts.Config.Branches.SetUpstream),
Handler: self.withItem(self.setAsUpstream),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.SetAsUpstream,
@ -81,13 +81,13 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.SortOrder),
Keys: opts.GetKeys(opts.Config.Branches.SortOrder),
Handler: self.createSortMenu,
Description: self.c.Tr.SortOrder,
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Keys: opts.GetKeys(opts.Config.Commits.ViewResetOptions),
Handler: self.withItem(self.createResetMenu),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.ViewResetOptions,
@ -95,7 +95,7 @@ func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts)
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Keys: opts.GetKeys(opts.Config.Universal.OpenDiffTool),
Handler: self.withItem(func(selectedBranch *models.RemoteBranch) error {
return self.c.Helpers().Diff.OpenDiffToolForRef(selectedBranch)
}),

View file

@ -45,20 +45,20 @@ func NewRemotesController(
func (self *RemotesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Handler: self.withItem(self.enter),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.ViewBranches,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.add,
Description: self.c.Tr.NewRemote,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItem(self.remove),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Remove,
@ -66,7 +66,7 @@ func (self *RemotesController) GetKeybindings(opts types.KeybindingsOpts) []*typ
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.withItem(self.edit),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Edit,
@ -74,7 +74,7 @@ func (self *RemotesController) GetKeybindings(opts types.KeybindingsOpts) []*typ
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.FetchRemote),
Keys: opts.GetKeys(opts.Config.Branches.FetchRemote),
Handler: self.withItem(self.fetch),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Fetch,
@ -82,7 +82,7 @@ func (self *RemotesController) GetKeybindings(opts types.KeybindingsOpts) []*typ
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.AddForkRemote),
Keys: opts.GetKeys(opts.Config.Branches.AddForkRemote),
Handler: self.addFork,
GetDisabledReason: self.hasOriginRemote(),
Description: self.c.Tr.AddForkRemote,

View file

@ -28,13 +28,13 @@ func NewRenameSimilarityThresholdController(
func (self *RenameSimilarityThresholdController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.IncreaseRenameSimilarityThreshold),
Keys: opts.GetKeys(opts.Config.Universal.IncreaseRenameSimilarityThreshold),
Handler: self.Increase,
Description: self.c.Tr.IncreaseRenameSimilarityThreshold,
Tooltip: self.c.Tr.IncreaseRenameSimilarityThresholdTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.DecreaseRenameSimilarityThreshold),
Keys: opts.GetKeys(opts.Config.Universal.DecreaseRenameSimilarityThreshold),
Handler: self.Decrease,
Description: self.c.Tr.DecreaseRenameSimilarityThreshold,
Tooltip: self.c.Tr.DecreaseRenameSimilarityThresholdTooltip,

View file

@ -36,7 +36,7 @@ func (self *SearchController) Context() types.Context {
func (self *SearchController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.StartSearch),
Keys: opts.GetKeys(opts.Config.Universal.StartSearch),
Handler: self.OpenSearchPrompt,
Description: self.c.Tr.StartSearch,
},

View file

@ -24,19 +24,19 @@ func NewSearchPromptController(
func (self *SearchPromptController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: []gocui.Key{gocui.NewKeyName(gocui.KeyEnter)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.KeyEnter)},
Handler: self.confirm,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.cancel,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: self.prevHistory,
},
{
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: self.nextHistory,
},
}

View file

@ -35,12 +35,12 @@ func NewSideWindowController(
func (self *SideWindowController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{Key: opts.GetKey(opts.Config.Universal.PrevBlock), Handler: self.previousSideWindow},
{Key: opts.GetKey(opts.Config.Universal.NextBlock), Handler: self.nextSideWindow},
{Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt), Handler: self.previousSideWindow},
{Key: opts.GetKey(opts.Config.Universal.NextBlockAlt), Handler: self.nextSideWindow},
{Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt2), Handler: self.previousSideWindow},
{Key: opts.GetKey(opts.Config.Universal.NextBlockAlt2), Handler: self.nextSideWindow},
{Keys: opts.GetKeys(opts.Config.Universal.PrevBlock), Handler: self.previousSideWindow},
{Keys: opts.GetKeys(opts.Config.Universal.NextBlock), Handler: self.nextSideWindow},
{Keys: opts.GetKeys(opts.Config.Universal.PrevBlockAlt), Handler: self.previousSideWindow},
{Keys: opts.GetKeys(opts.Config.Universal.NextBlockAlt), Handler: self.nextSideWindow},
{Keys: opts.GetKeys(opts.Config.Universal.PrevBlockAlt2), Handler: self.previousSideWindow},
{Keys: opts.GetKeys(opts.Config.Universal.NextBlockAlt2), Handler: self.nextSideWindow},
}
}

View file

@ -24,23 +24,23 @@ func NewSnakeController(
func (self *SnakeController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: self.SetDirection(snake.Down),
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: self.SetDirection(snake.Up),
},
{
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
Keys: opts.GetKeys(opts.Config.Universal.PrevBlock),
Handler: self.SetDirection(snake.Left),
},
{
Key: opts.GetKey(opts.Config.Universal.NextBlock),
Keys: opts.GetKeys(opts.Config.Universal.NextBlock),
Handler: self.SetDirection(snake.Right),
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.Escape,
},
}

View file

@ -41,69 +41,69 @@ func NewStagingController(
func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.ToggleStaged,
Description: self.c.Tr.Stage,
Tooltip: self.c.Tr.StageSelectionTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.DiscardSelection,
Description: self.c.Tr.DiscardSelection,
Tooltip: self.c.Tr.DiscardSelectionTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.OpenFile,
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.EditFile,
Description: self.c.Tr.EditFile,
Tooltip: self.c.Tr.EditFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: self.Escape,
Description: self.c.Tr.ReturnToFilesPanel,
DescriptionFunc: self.EscapeDescription,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
Handler: self.TogglePanel,
Description: self.c.Tr.ToggleStagingView,
Tooltip: self.c.Tr.ToggleStagingViewTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Main.EditSelectHunk),
Keys: opts.GetKeys(opts.Config.Main.EditSelectHunk),
Handler: self.EditHunkAndRefresh,
Description: self.c.Tr.EditHunk,
Tooltip: self.c.Tr.EditHunkTooltip,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChanges),
Keys: opts.GetKeys(opts.Config.Files.CommitChanges),
Handler: self.c.Helpers().WorkingTree.HandleCommitPress,
Description: self.c.Tr.Commit,
Tooltip: self.c.Tr.CommitTooltip,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChangesWithoutHook),
Keys: opts.GetKeys(opts.Config.Files.CommitChangesWithoutHook),
Handler: self.c.Helpers().WorkingTree.HandleWIPCommitPress,
Description: self.c.Tr.CommitChangesWithoutHook,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChangesWithEditor),
Keys: opts.GetKeys(opts.Config.Files.CommitChangesWithEditor),
Handler: self.c.Helpers().WorkingTree.HandleCommitEditorPress,
Description: self.c.Tr.CommitChangesWithEditor,
},
{
Key: opts.GetKey(opts.Config.Files.FindBaseCommitForFixup),
Keys: opts.GetKeys(opts.Config.Files.FindBaseCommitForFixup),
Handler: self.c.Helpers().FixupHelper.HandleFindBaseCommitForFixupPress,
Description: self.c.Tr.FindBaseCommitForFixup,
Tooltip: self.c.Tr.FindBaseCommitForFixupTooltip,

View file

@ -36,7 +36,7 @@ func NewStashController(
func (self *StashController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.handleStashApply),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Apply,
@ -44,7 +44,7 @@ func (self *StashController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Stash.PopStash),
Keys: opts.GetKeys(opts.Config.Stash.PopStash),
Handler: self.withItem(self.handleStashPop),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Pop,
@ -52,7 +52,7 @@ func (self *StashController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItems(self.handleStashDrop),
GetDisabledReason: self.require(self.itemRangeSelected()),
Description: self.c.Tr.Drop,
@ -60,14 +60,14 @@ func (self *StashController) GetKeybindings(opts types.KeybindingsOpts) []*types
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.withItem(self.handleNewBranchOffStashEntry),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.NewBranch,
Tooltip: self.c.Tr.NewBranchFromStashTooltip,
},
{
Key: opts.GetKey(opts.Config.Stash.RenameStash),
Keys: opts.GetKeys(opts.Config.Stash.RenameStash),
Handler: self.withItem(self.handleRenameStashEntry),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.RenameStash,

View file

@ -34,37 +34,37 @@ func NewStatusController(
func (self *StatusController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.openConfig,
Description: self.c.Tr.OpenConfig,
Tooltip: self.c.Tr.OpenFileTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.editConfig,
Description: self.c.Tr.EditConfig,
Tooltip: self.c.Tr.EditFileTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Status.CheckForUpdate),
Keys: opts.GetKeys(opts.Config.Status.CheckForUpdate),
Handler: self.handleCheckForUpdate,
Description: self.c.Tr.CheckForUpdate,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Status.RecentRepos),
Keys: opts.GetKeys(opts.Config.Status.RecentRepos),
Handler: self.c.Helpers().Repos.CreateRecentReposMenu,
Description: self.c.Tr.SwitchRepo,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Status.AllBranchesLogGraph),
Keys: opts.GetKeys(opts.Config.Status.AllBranchesLogGraph),
Handler: func() error { self.switchToOrRotateAllBranchesLogs(); return nil },
Description: self.c.Tr.AllBranchesLogGraph,
},
{
Key: opts.GetKey(opts.Config.Status.AllBranchesLogGraphReverse),
Keys: opts.GetKeys(opts.Config.Status.AllBranchesLogGraphReverse),
Handler: func() error { self.switchToOrRotateAllBranchesLogsBackward(); return nil },
Description: self.c.Tr.AllBranchesLogGraphReverse,
},

View file

@ -39,7 +39,7 @@ func NewSubmodulesController(
func (self *SubmodulesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Handler: self.withItem(self.enter),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Enter,
@ -48,12 +48,12 @@ func (self *SubmodulesController) GetKeybindings(opts types.KeybindingsOpts) []*
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.enter),
GetDisabledReason: self.require(self.singleItemSelected()),
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItem(self.remove),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Remove,
@ -61,7 +61,7 @@ func (self *SubmodulesController) GetKeybindings(opts types.KeybindingsOpts) []*
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Submodules.Update),
Keys: opts.GetKeys(opts.Config.Submodules.Update),
Handler: self.withItem(self.update),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Update,
@ -69,26 +69,26 @@ func (self *SubmodulesController) GetKeybindings(opts types.KeybindingsOpts) []*
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.add,
Description: self.c.Tr.NewSubmodule,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: self.withItem(self.editURL),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.EditSubmoduleUrl,
},
{
Key: opts.GetKey(opts.Config.Submodules.Init),
Keys: opts.GetKeys(opts.Config.Submodules.Init),
Handler: self.withItem(self.init),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Initialize,
Tooltip: self.c.Tr.InitSubmoduleTooltip,
},
{
Key: opts.GetKey(opts.Config.Submodules.BulkMenu),
Keys: opts.GetKeys(opts.Config.Submodules.BulkMenu),
Handler: self.openBulkActionsMenu,
Description: self.c.Tr.ViewBulkSubmoduleOptions,
OpensMenu: true,
@ -233,7 +233,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error {
return nil
})
},
Key: menuKey('i'),
Keys: menuKey('i'),
},
{
LabelColumns: []string{self.c.Tr.BulkUpdateSubmodules, style.FgYellow.Sprint(self.c.Git().Submodule.BulkUpdateCmdObj().ToString())},
@ -248,7 +248,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error {
return nil
})
},
Key: menuKey('u'),
Keys: menuKey('u'),
},
{
LabelColumns: []string{self.c.Tr.BulkUpdateRecursiveSubmodules, style.FgYellow.Sprint(self.c.Git().Submodule.BulkUpdateRecursivelyCmdObj().ToString())},
@ -263,7 +263,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error {
return nil
})
},
Key: menuKey('r'),
Keys: menuKey('r'),
},
{
LabelColumns: []string{self.c.Tr.BulkDeinitSubmodules, style.FgRed.Sprint(self.c.Git().Submodule.BulkDeinitCmdObj().ToString())},
@ -278,7 +278,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error {
return nil
})
},
Key: menuKey('d'),
Keys: menuKey('d'),
},
},
})

View file

@ -32,26 +32,26 @@ func NewSuggestionsController(
func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.ConfirmSuggestion),
Keys: opts.GetKeys(opts.Config.Universal.ConfirmSuggestion),
Handler: func() error { return self.context().State.OnConfirm() },
GetDisabledReason: self.require(self.singleItemSelected()),
},
{
Key: opts.GetKey(opts.Config.Universal.Return),
Keys: opts.GetKeys(opts.Config.Universal.Return),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Keys: opts.GetKeys(opts.Config.Universal.TogglePanel),
Handler: self.switchToPrompt,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: func() error {
return self.context().State.OnDeleteSuggestion()
},
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Keys: opts.GetKeys(opts.Config.Universal.Edit),
Handler: func() error {
if self.context().State.AllowEditSuggestion {
if selectedItem := self.c.Contexts().Suggestions.GetSelected(); selectedItem != nil {

View file

@ -40,7 +40,7 @@ func NewSwitchToDiffFilesController(
func (self *SwitchToDiffFilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Handler: self.enter,
GetDisabledReason: self.canEnter,
Description: self.c.Tr.ViewItemFiles,

View file

@ -29,7 +29,7 @@ func NewSwitchToFocusedMainViewController(
func (self *SwitchToFocusedMainViewController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.FocusMainView),
Keys: opts.GetKeys(opts.Config.Universal.FocusMainView),
Handler: self.handleFocusMainView,
Description: self.c.Tr.FocusMainView,
Tag: "global",

View file

@ -47,7 +47,7 @@ func (self *SwitchToSubCommitsController) GetKeybindings(opts types.KeybindingsO
{
Handler: self.viewCommits,
GetDisabledReason: self.require(self.singleItemSelected()),
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Description: self.c.Tr.ViewCommits,
},
}

View file

@ -32,14 +32,14 @@ func NewSyncController(
func (self *SyncController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Push),
Keys: opts.GetKeys(opts.Config.Universal.Push),
Handler: opts.Guards.NoPopupPanel(self.HandlePush),
GetDisabledReason: self.getDisabledReasonForPushOrPull,
Description: self.c.Tr.Push,
Tooltip: self.c.Tr.PushTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Pull),
Keys: opts.GetKeys(opts.Config.Universal.Pull),
Handler: opts.Guards.NoPopupPanel(self.HandlePull),
GetDisabledReason: self.getDisabledReasonForPushOrPull,
Description: self.c.Tr.Pull,

View file

@ -39,7 +39,7 @@ func NewTagsController(
func (self *TagsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.checkout),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Checkout,
@ -47,14 +47,14 @@ func (self *TagsController) GetKeybindings(opts types.KeybindingsOpts) []*types.
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.create,
Description: self.c.Tr.NewTag,
Tooltip: self.c.Tr.NewTagTooltip,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItem(self.delete),
Description: self.c.Tr.Delete,
GetDisabledReason: self.require(self.singleItemSelected()),
@ -63,7 +63,7 @@ func (self *TagsController) GetKeybindings(opts types.KeybindingsOpts) []*types.
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.PushTag),
Keys: opts.GetKeys(opts.Config.Branches.PushTag),
Handler: self.withItem(self.push),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.PushTag,
@ -71,7 +71,7 @@ func (self *TagsController) GetKeybindings(opts types.KeybindingsOpts) []*types.
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Keys: opts.GetKeys(opts.Config.Commits.ViewResetOptions),
Handler: self.withItem(self.createResetMenu),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Reset,
@ -80,7 +80,7 @@ func (self *TagsController) GetKeybindings(opts types.KeybindingsOpts) []*types.
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenDiffTool),
Keys: opts.GetKeys(opts.Config.Universal.OpenDiffTool),
Handler: self.withItem(func(selectedTag *models.Tag) error {
return self.c.Helpers().Diff.OpenDiffToolForRef(selectedTag)
}),
@ -282,14 +282,14 @@ func (self *TagsController) delete(tag *models.Tag) error {
menuItems := []*types.MenuItem{
{
Label: self.c.Tr.DeleteLocalTag,
Key: menuKey('c'),
Keys: menuKey('c'),
OnPress: func() error {
return self.localDelete(tag)
},
},
{
Label: self.c.Tr.DeleteRemoteTag,
Key: menuKey('r'),
Keys: menuKey('r'),
OpensMenu: true,
OnPress: func() error {
return self.remoteDelete(tag)
@ -297,7 +297,7 @@ func (self *TagsController) delete(tag *models.Tag) error {
},
{
Label: self.c.Tr.DeleteLocalAndRemoteTag,
Key: menuKey('b'),
Keys: menuKey('b'),
OpensMenu: true,
OnPress: func() error {
return self.localAndRemoteDelete(tag)

View file

@ -53,13 +53,13 @@ type reflogAction struct {
func (self *UndoController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Undo),
Keys: opts.GetKeys(opts.Config.Universal.Undo),
Handler: self.reflogUndo,
Description: self.c.Tr.UndoReflog,
Tooltip: self.c.Tr.UndoTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Redo),
Keys: opts.GetKeys(opts.Config.Universal.Redo),
Handler: self.reflogRedo,
Description: self.c.Tr.RedoReflog,
Tooltip: self.c.Tr.RedoTooltip,

View file

@ -36,16 +36,16 @@ func (self *ViewSelectionController) Context() types.Context {
func (self *ViewSelectionController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevItem), Handler: self.handlePrevLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevItemAlt), Handler: self.handlePrevLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextItem), Handler: self.handleNextLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextItemAlt), Handler: self.handleNextLine},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.PrevPage), Handler: self.handlePrevPage, Description: self.c.Tr.PrevPage},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.NextPage), Handler: self.handleNextPage, Description: self.c.Tr.NextPage},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoTop), Handler: self.handleGotoTop, Description: self.c.Tr.GotoTop, Alternative: "<home>"},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoBottom), Handler: self.handleGotoBottom, Description: self.c.Tr.GotoBottom, Alternative: "<end>"},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoTopAlt), Handler: self.handleGotoTop},
{Tag: "navigation", Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt), Handler: self.handleGotoBottom},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.PrevItem), Handler: self.handlePrevLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.PrevItemAlt), Handler: self.handlePrevLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.NextItem), Handler: self.handleNextLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.NextItemAlt), Handler: self.handleNextLine},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.PrevPage), Handler: self.handlePrevPage, Description: self.c.Tr.PrevPage},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.NextPage), Handler: self.handleNextPage, Description: self.c.Tr.NextPage},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoTop), Handler: self.handleGotoTop, Description: self.c.Tr.GotoTop, Alternative: "<home>"},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoBottom), Handler: self.handleGotoBottom, Description: self.c.Tr.GotoBottom, Alternative: "<end>"},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoTopAlt), Handler: self.handleGotoTop},
{Tag: "navigation", Keys: opts.GetKeys(opts.Config.Universal.GotoBottomAlt), Handler: self.handleGotoBottom},
}
}

View file

@ -53,7 +53,7 @@ func (self *FilesController) createResetMenu() error {
})
return nil
},
Key: menuKey('x'),
Keys: menuKey('x'),
Tooltip: self.c.Tr.NukeDescription,
},
{
@ -72,7 +72,7 @@ func (self *FilesController) createResetMenu() error {
)
return nil
},
Key: menuKey('u'),
Keys: menuKey('u'),
},
{
LabelColumns: []string{
@ -90,7 +90,7 @@ func (self *FilesController) createResetMenu() error {
)
return nil
},
Key: menuKey('c'),
Keys: menuKey('c'),
},
{
LabelColumns: []string{
@ -115,7 +115,7 @@ func (self *FilesController) createResetMenu() error {
)
return nil
},
Key: menuKey('S'),
Keys: menuKey('S'),
},
{
LabelColumns: []string{
@ -133,7 +133,7 @@ func (self *FilesController) createResetMenu() error {
)
return nil
},
Key: menuKey('s'),
Keys: menuKey('s'),
},
{
LabelColumns: []string{
@ -151,7 +151,7 @@ func (self *FilesController) createResetMenu() error {
)
return nil
},
Key: menuKey('m'),
Keys: menuKey('m'),
},
{
LabelColumns: []string{
@ -176,7 +176,7 @@ func (self *FilesController) createResetMenu() error {
},
})
},
Key: menuKey('h'),
Keys: menuKey('h'),
},
}

View file

@ -36,7 +36,7 @@ func NewWorktreeOptionsController(c *ControllerCommon, context CanViewWorktreeOp
func (self *WorktreeOptionsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Worktrees.ViewWorktreeOptions),
Keys: opts.GetKeys(opts.Config.Worktrees.ViewWorktreeOptions),
Handler: self.withItem(self.viewWorktreeOptions),
Description: self.c.Tr.ViewWorktreeOptions,
OpensMenu: true,

View file

@ -39,13 +39,13 @@ func NewWorktreesController(
func (self *WorktreesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.New),
Keys: opts.GetKeys(opts.Config.Universal.New),
Handler: self.add,
Description: self.c.Tr.NewWorktree,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Select),
Keys: opts.GetKeys(opts.Config.Universal.Select),
Handler: self.withItem(self.enter),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Switch,
@ -53,18 +53,18 @@ func (self *WorktreesController) GetKeybindings(opts types.KeybindingsOpts) []*t
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.GoInto),
Keys: opts.GetKeys(opts.Config.Universal.GoInto),
Handler: self.withItem(self.enter),
GetDisabledReason: self.require(self.singleItemSelected()),
},
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Keys: opts.GetKeys(opts.Config.Universal.OpenFile),
Handler: self.withItem(self.open),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.OpenInEditor,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Keys: opts.GetKeys(opts.Config.Universal.Remove),
Handler: self.withItem(self.remove),
GetDisabledReason: self.require(self.singleItemSelected()),
Description: self.c.Tr.Remove,

View file

@ -15,7 +15,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
Items: []*types.MenuItem{
{
Label: gui.c.Tr.ToggleShowCommandLog,
Key: []gocui.Key{gocui.NewKeyRune('t')},
Keys: []gocui.Key{gocui.NewKeyRune('t')},
OnPress: func() error {
currentContext := gui.c.Context().CurrentStatic()
if gui.c.State().GetShowExtrasWindow() && currentContext.GetKey() == context.COMMAND_LOG_CONTEXT_KEY {
@ -30,7 +30,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
},
{
Label: gui.c.Tr.FocusCommandLog,
Key: []gocui.Key{gocui.NewKeyRune('f')},
Keys: []gocui.Key{gocui.NewKeyRune('f')},
OnPress: gui.handleFocusCommandLog,
},
},

View file

@ -69,9 +69,9 @@ func (gui *Gui) keybindingOpts() types.KeybindingsOpts {
}
return types.KeybindingsOpts{
GetKey: config.GetValidatedKeyBindingKeys,
Config: keybindingConfig,
Guards: guards,
GetKeys: config.GetValidatedKeyBindingKeys,
Config: keybindingConfig,
Guards: guards,
}
}
@ -81,114 +81,114 @@ func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBin
bindings := []*types.Binding{
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.OpenRecentRepos),
Keys: opts.GetKeys(opts.Config.Universal.OpenRecentRepos),
Handler: opts.Guards.NoPopupPanel(gui.helpers.Repos.CreateRecentReposMenu),
Description: gui.c.Tr.SwitchRepo,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollUpMain),
Keys: opts.GetKeys(opts.Config.Universal.ScrollUpMain),
Handler: gui.scrollUpMain,
Alternative: "fn+up/shift+k",
Description: gui.c.Tr.ScrollUpMainWindow,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollDownMain),
Keys: opts.GetKeys(opts.Config.Universal.ScrollDownMain),
Handler: gui.scrollDownMain,
Alternative: "fn+down/shift+j",
Description: gui.c.Tr.ScrollDownMainWindow,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt1),
Keys: opts.GetKeys(opts.Config.Universal.ScrollUpMainAlt1),
Handler: gui.scrollUpMain,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt1),
Keys: opts.GetKeys(opts.Config.Universal.ScrollDownMainAlt1),
Handler: gui.scrollDownMain,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollUpMainAlt2),
Keys: opts.GetKeys(opts.Config.Universal.ScrollUpMainAlt2),
Handler: gui.scrollUpMain,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ScrollDownMainAlt2),
Keys: opts.GetKeys(opts.Config.Universal.ScrollDownMainAlt2),
Handler: gui.scrollDownMain,
},
{
ViewName: "files",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyPathToClipboard,
},
{
ViewName: "localBranches",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyBranchNameToClipboard,
},
{
ViewName: "remoteBranches",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyBranchNameToClipboard,
},
{
ViewName: "tags",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyTagToClipboard,
},
{
ViewName: "commits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemCommitHashToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyCommitHashToClipboard,
},
{
ViewName: "commits",
Key: opts.GetKey(opts.Config.Commits.ResetCherryPick),
Keys: opts.GetKeys(opts.Config.Commits.ResetCherryPick),
Handler: gui.helpers.CherryPick.Reset,
Description: gui.c.Tr.ResetCherryPick,
},
{
ViewName: "reflogCommits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyCommitHashToClipboard,
},
{
ViewName: "subCommits",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemCommitHashToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyCommitHashToClipboard,
},
{
ViewName: "information",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseLeft)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseLeft)},
Handler: gui.handleInfoClick,
},
{
ViewName: "commitFiles",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopyPathToClipboard,
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.ExtrasMenu),
Keys: opts.GetKeys(opts.Config.Universal.ExtrasMenu),
Handler: opts.Guards.NoPopupPanel(gui.handleCreateExtrasMenuPanel),
Description: gui.c.Tr.OpenCommandLogMenu,
Tooltip: gui.c.Tr.OpenCommandLogMenuTooltip,
@ -196,163 +196,163 @@ func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBin
},
{
ViewName: "main",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Handler: gui.scrollDownMain,
Description: gui.c.Tr.ScrollDown,
Alternative: "fn+up",
},
{
ViewName: "main",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Handler: gui.scrollUpMain,
Description: gui.c.Tr.ScrollUp,
Alternative: "fn+down",
},
{
ViewName: "secondary",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Handler: gui.scrollDownSecondary,
},
{
ViewName: "secondary",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Handler: gui.scrollUpSecondary,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: gui.scrollUpConfirmationPanel,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: gui.scrollDownConfirmationPanel,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.PrevItemAlt),
Handler: gui.scrollUpConfirmationPanel,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.NextItemAlt),
Handler: gui.scrollDownConfirmationPanel,
},
{
ViewName: "confirmation",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Handler: gui.scrollUpConfirmationPanel,
},
{
ViewName: "confirmation",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Handler: gui.scrollDownConfirmationPanel,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.NextPage),
Keys: opts.GetKeys(opts.Config.Universal.NextPage),
Handler: gui.pageDownConfirmationPanel,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.PrevPage),
Keys: opts.GetKeys(opts.Config.Universal.PrevPage),
Handler: gui.pageUpConfirmationPanel,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoTop),
Keys: opts.GetKeys(opts.Config.Universal.GotoTop),
Handler: gui.goToConfirmationPanelTop,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
Keys: opts.GetKeys(opts.Config.Universal.GotoTopAlt),
Handler: gui.goToConfirmationPanelTop,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoBottom),
Keys: opts.GetKeys(opts.Config.Universal.GotoBottom),
Handler: gui.goToConfirmationPanelBottom,
},
{
ViewName: "confirmation",
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
Keys: opts.GetKeys(opts.Config.Universal.GotoBottomAlt),
Handler: gui.goToConfirmationPanelBottom,
},
{
ViewName: "submodules",
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
Keys: opts.GetKeys(opts.Config.Universal.CopyToClipboard),
Handler: gui.handleCopySelectedSideContextItemToClipboard,
GetDisabledReason: gui.getCopySelectedSideContextItemToClipboardDisabledReason,
Description: gui.c.Tr.CopySubmoduleNameToClipboard,
},
{
ViewName: "extras",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelUp)},
Handler: gui.scrollUpExtra,
},
{
ViewName: "extras",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseWheelDown)},
Handler: gui.scrollDownExtra,
},
{
ViewName: "extras",
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.PrevItemAlt),
Handler: gui.scrollUpExtra,
},
{
ViewName: "extras",
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Keys: opts.GetKeys(opts.Config.Universal.PrevItem),
Handler: gui.scrollUpExtra,
},
{
ViewName: "extras",
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextItem),
Keys: opts.GetKeys(opts.Config.Universal.NextItem),
Handler: gui.scrollDownExtra,
},
{
ViewName: "extras",
Tag: "navigation",
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
Keys: opts.GetKeys(opts.Config.Universal.NextItemAlt),
Handler: gui.scrollDownExtra,
},
{
ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.NextPage),
Keys: opts.GetKeys(opts.Config.Universal.NextPage),
Handler: gui.pageDownExtrasPanel,
},
{
ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.PrevPage),
Keys: opts.GetKeys(opts.Config.Universal.PrevPage),
Handler: gui.pageUpExtrasPanel,
},
{
ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoTop),
Keys: opts.GetKeys(opts.Config.Universal.GotoTop),
Handler: gui.goToExtrasPanelTop,
},
{
ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoTopAlt),
Keys: opts.GetKeys(opts.Config.Universal.GotoTopAlt),
Handler: gui.goToExtrasPanelTop,
},
{
ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoBottom),
Keys: opts.GetKeys(opts.Config.Universal.GotoBottom),
Handler: gui.goToExtrasPanelBottom,
},
{
ViewName: "extras",
Key: opts.GetKey(opts.Config.Universal.GotoBottomAlt),
Keys: opts.GetKeys(opts.Config.Universal.GotoBottomAlt),
Handler: gui.goToExtrasPanelBottom,
},
{
ViewName: "extras",
Tag: "navigation",
Key: []gocui.Key{gocui.NewKeyName(gocui.MouseLeft)},
Keys: []gocui.Key{gocui.NewKeyName(gocui.MouseLeft)},
Handler: gui.handleFocusCommandLog,
},
}
@ -372,14 +372,14 @@ func (gui *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBin
bindings = append(bindings, []*types.Binding{
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.NextTab),
Keys: opts.GetKeys(opts.Config.Universal.NextTab),
Handler: opts.Guards.NoPopupPanel(gui.handleNextTab),
Description: gui.c.Tr.NextTab,
Tag: "navigation",
},
{
ViewName: "",
Key: opts.GetKey(opts.Config.Universal.PrevTab),
Keys: opts.GetKeys(opts.Config.Universal.PrevTab),
Handler: opts.Guards.NoPopupPanel(gui.handlePrevTab),
Description: gui.c.Tr.PrevTab,
Tag: "navigation",
@ -448,7 +448,7 @@ func (gui *Gui) SetKeybinding(binding *types.Binding) {
return gui.callKeybindingHandler(binding)
}
for _, key := range binding.Key {
for _, key := range binding.Keys {
gui.g.SetKeybinding(binding.ViewName, key, handler)
}
}

View file

@ -47,7 +47,7 @@ func (gui *Gui) createMenu(opts types.CreateMenuOptions) error {
// Remove all item keybindings that are the same as one of the essential bindings
if !opts.KeepConflictingKeybindings {
item.Key = lo.Filter(item.Key, func(k gocui.Key, _ int) bool {
item.Keys = lo.Filter(item.Keys, func(k gocui.Key, _ int) bool {
return !lo.Contains(essentialKeys, k)
})
}

View file

@ -42,11 +42,11 @@ func (self *OptionsMapMgr) renderContextOptionsMap() {
currentContextKeys := set.NewFromSlice(
lo.FlatMap(currentContextBindings, func(binding *types.Binding, _ int) []gocui.Key {
return binding.Key
return binding.Keys
}))
allBindings := append(currentContextBindings, lo.Filter(globalBindings, func(b *types.Binding, _ int) bool {
return len(b.Key) == 0 || !currentContextKeys.Includes(b.Key[0])
return len(b.Keys) == 0 || !currentContextKeys.Includes(b.Keys[0])
})...)
bindingsToDisplay := lo.Filter(allBindings, func(binding *types.Binding, _ int) bool {
@ -60,7 +60,7 @@ func (self *OptionsMapMgr) renderContextOptionsMap() {
}
return bindingInfo{
key: config.LabelForKey(binding.Key[0]),
key: config.LabelForKey(binding.Keys[0]),
description: binding.GetShortDescription(),
style: displayStyle,
}

View file

@ -46,7 +46,7 @@ func (self *Client) GetCustomCommandKeybindings() ([]*types.Binding, error) {
}
bindings = append(bindings, &types.Binding{
ViewName: "", // custom commands menus are global; we filter the commands inside by context
Key: []gocui.Key{config.GetValidatedKeyBindingKey(customCommand.Key)},
Keys: []gocui.Key{config.GetValidatedKeyBindingKey(customCommand.Key)},
Handler: handler,
Description: getCustomCommandsMenuDescription(customCommand, self.c.Tr),
OpensMenu: true,
@ -73,7 +73,7 @@ func (self *Client) showCustomCommandsMenu(customCommand config.CustomCommand) e
}
menuItems = append(menuItems, &types.MenuItem{
Label: subCommand.GetDescription(),
Key: []gocui.Key{config.GetValidatedKeyBindingKey(subCommand.Key)},
Keys: []gocui.Key{config.GetValidatedKeyBindingKey(subCommand.Key)},
OnPress: handler,
OpensMenu: true,
})
@ -93,7 +93,7 @@ func (self *Client) showCustomCommandsMenu(customCommand config.CustomCommand) e
menuItems = append(menuItems, &types.MenuItem{
Label: subCommand.GetDescription(),
Key: []gocui.Key{config.GetValidatedKeyBindingKey(subCommand.Key)},
Keys: []gocui.Key{config.GetValidatedKeyBindingKey(subCommand.Key)},
OnPress: self.handlerCreator.call(subCommand),
})
}

View file

@ -232,7 +232,7 @@ func (self *HandlerCreator) menuPrompt(prompt *config.CustomCommandPrompt, wrapp
OnPress: func() error {
return wrappedF(option.Value)
},
Key: []gocui.Key{config.GetValidatedKeyBindingKey(option.Key)},
Keys: []gocui.Key{config.GetValidatedKeyBindingKey(option.Key)},
}
})

View file

@ -36,7 +36,7 @@ func (self *KeybindingCreator) call(customCommand config.CustomCommand, handler
return lo.Map(viewNames, func(viewName string, _ int) *types.Binding {
return &types.Binding{
ViewName: viewName,
Key: []gocui.Key{config.GetValidatedKeyBindingKey(customCommand.Key)},
Keys: []gocui.Key{config.GetValidatedKeyBindingKey(customCommand.Key)},
Handler: handler,
Description: customCommand.GetDescription(),
}

View file

@ -259,10 +259,10 @@ type MenuItem struct {
// Only applies when Label is used
OpensMenu bool
// If Key is non-empty, the user can press any of these keys to invoke the
// If Keys is non-empty, the user can press any of these keys to invoke the
// menu item, as opposed to having to navigate to it. Only the first key is
// shown in the menu; the alternates are matched silently.
Key []gocui.Key
Keys []gocui.Key
// A widget to show in front of the menu item. Supported widget types are
// checkboxes and radio buttons,

View file

@ -239,9 +239,9 @@ type OnFocusLostOpts struct {
type ContextKey string
type KeybindingsOpts struct {
GetKey func(key string) []gocui.Key
Config config.KeybindingConfig
Guards KeybindingGuards
GetKeys func(key string) []gocui.Key
Config config.KeybindingConfig
Guards KeybindingGuards
}
type (

View file

@ -11,7 +11,7 @@ import (
type Binding struct {
ViewName string
Handler func() error
Key []gocui.Key
Keys []gocui.Key
Description string
// DescriptionFunc is used instead of Description if non-nil, and is useful for dynamic
// descriptions that change depending on context. Important: this must not be an expensive call.