diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-26 10:03:04 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-28 08:33:13 +1100 |
commit | 1a38d515d78ceb60c2f88813c2c3ba8708315e48 (patch) | |
tree | 7b0251ccd44b5caf7e05b9dc176edca10ff017d1 /pkg/gui/controllers/local_commits_controller.go | |
parent | 0f9d9e13d12d37ab419efccc5c217422fb67a765 (diff) |
Display more keybindings on-screen
Diffstat (limited to 'pkg/gui/controllers/local_commits_controller.go')
-rw-r--r-- | pkg/gui/controllers/local_commits_controller.go | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 25abd2c85..3dc1bae7f 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -64,8 +64,9 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ self.canSquashOrFixup, ), ), - Description: self.c.Tr.Squash, - Tooltip: self.c.Tr.SquashTooltip, + Description: self.c.Tr.Squash, + Tooltip: self.c.Tr.SquashTooltip, + DisplayOnScreen: true, }, { Key: opts.GetKey(opts.Config.Commits.MarkCommitAsFixup), @@ -76,8 +77,9 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ self.canSquashOrFixup, ), ), - Description: self.c.Tr.Fixup, - Tooltip: self.c.Tr.FixupTooltip, + Description: self.c.Tr.Fixup, + Tooltip: self.c.Tr.FixupTooltip, + DisplayOnScreen: true, }, { Key: opts.GetKey(opts.Config.Commits.RenameCommit), @@ -85,9 +87,10 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ GetDisabledReason: self.require( self.singleItemSelected(self.rewordEnabled), ), - Description: self.c.Tr.Reword, - Tooltip: self.c.Tr.CommitRewordTooltip, - OpensMenu: true, + Description: self.c.Tr.Reword, + Tooltip: self.c.Tr.CommitRewordTooltip, + DisplayOnScreen: true, + OpensMenu: true, }, { Key: opts.GetKey(opts.Config.Commits.RenameCommitWithEditor), @@ -105,8 +108,9 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ self.midRebaseCommandEnabled, ), ), - Description: self.c.Tr.DropCommit, - Tooltip: self.c.Tr.DropCommitTooltip, + Description: self.c.Tr.DropCommit, + Tooltip: self.c.Tr.DropCommitTooltip, + DisplayOnScreen: true, }, { Key: opts.GetKey(editCommitKey), @@ -118,6 +122,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ Description: self.c.Tr.EditCommit, ShortDescription: self.c.Tr.Edit, Tooltip: self.c.Tr.EditCommitTooltip, + DisplayOnScreen: true, }, { // The user-facing description here is 'Start interactive rebase' but internally @@ -139,6 +144,14 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ ), Description: self.c.Tr.Pick, Tooltip: self.c.Tr.PickCommitTooltip, + // Not displaying this because we only want to display it when a TODO commit + // is selected. A keybinding is displayed in the options view if Display is true, + // and if it's not disabled, but if we disable it whenever a non-TODO commit is + // selected, we'll be preventing pulls from happening within the commits view + // (given they both use the 'p' key). Some approaches that come to mind: + // * Allow a disabled keybinding to conditionally fallback to a global keybinding + // * Allow a separate way of deciding whether a keybinding is displayed in the options view + DisplayOnScreen: false, }, { Key: opts.GetKey(opts.Config.Commits.CreateFixupCommit), @@ -221,6 +234,7 @@ func (self *LocalCommitsController) GetKeybindings(opts types.KeybindingsOpts) [ GetDisabledReason: self.require(self.singleItemSelected(self.canAmend)), Description: self.c.Tr.Amend, Tooltip: self.c.Tr.AmendCommitTooltip, + DisplayOnScreen: true, }, { Key: opts.GetKey(opts.Config.Commits.ResetCommitAuthor), |