Skip to content

Commit

Permalink
Update Display to DisplayOnscreen
Browse files Browse the repository at this point in the history
Display is too general a term: keybindings will always be displayed in the keybindings menu,
but only sometimes be displayed on-screen in the options view
  • Loading branch information
jesseduffield committed Jan 7, 2024
1 parent 82ce786 commit 110b025
Show file tree
Hide file tree
Showing 24 changed files with 323 additions and 322 deletions.
24 changes: 12 additions & 12 deletions pkg/gui/controllers/basic_commits_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ func NewBasicCommitsController(controllerCommon *ControllerCommon, context Conta
func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Commits.CheckoutCommit),
Handler: self.checkSelected(self.checkout),
Description: self.c.Tr.Checkout,
Tooltip: self.c.Tr.CheckoutCommitTooltip,
Display: true,
Key: opts.GetKey(opts.Config.Commits.CheckoutCommit),
Handler: self.checkSelected(self.checkout),
Description: self.c.Tr.Checkout,
Tooltip: self.c.Tr.CheckoutCommitTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.OpenInBrowser),
Expand All @@ -54,12 +54,12 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
Description: self.c.Tr.CreateNewBranchFromCommit,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Handler: self.checkSelected(self.createResetMenu),
Description: self.c.Tr.ViewResetOptions,
Tooltip: self.c.Tr.ResetTooltip,
OpensMenu: true,
Display: true,
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Handler: self.checkSelected(self.createResetMenu),
Description: self.c.Tr.ViewResetOptions,
Tooltip: self.c.Tr.ResetTooltip,
OpensMenu: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.CherryPickCopy),
Expand All @@ -71,7 +71,7 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
"escape": keybindings.Label(opts.Config.Universal.Return),
},
),
Display: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Commits.CherryPickCopyRange),
Expand Down
58 changes: 29 additions & 29 deletions pkg/gui/controllers/branches_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
GetDisabledReason: self.getDisabledReasonForPress,
Description: self.c.Tr.Checkout,
Tooltip: self.c.Tr.CheckoutTooltip,
Display: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.New),
Handler: self.checkSelected(self.newBranch),
Description: self.c.Tr.NewBranch,
Display: true,
Key: opts.GetKey(opts.Config.Universal.New),
Handler: self.checkSelected(self.newBranch),
Description: self.c.Tr.NewBranch,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.CreatePullRequest),
Expand Down Expand Up @@ -76,27 +76,27 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
Tooltip: self.c.Tr.ForceCheckoutTooltip,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: self.checkSelectedAndReal(self.delete),
Description: self.c.Tr.Delete,
Tooltip: self.c.Tr.BranchDeleteTooltip,
OpensMenu: true,
Display: true,
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: self.checkSelectedAndReal(self.delete),
Description: self.c.Tr.Delete,
Tooltip: self.c.Tr.BranchDeleteTooltip,
OpensMenu: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.RebaseBranch),
Handler: opts.Guards.OutsideFilterMode(self.rebase),
Description: self.c.Tr.RebaseBranch,
Tooltip: self.c.Tr.RebaseBranchTooltip,
GetDisabledReason: self.getDisabledReasonForRebase,
Display: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.MergeIntoCurrentBranch),
Handler: opts.Guards.OutsideFilterMode(self.merge),
Description: self.c.Tr.Merge,
Tooltip: self.c.Tr.MergeBranchTooltip,
Display: true,
Key: opts.GetKey(opts.Config.Branches.MergeIntoCurrentBranch),
Handler: opts.Guards.OutsideFilterMode(self.merge),
Description: self.c.Tr.Merge,
Tooltip: self.c.Tr.MergeBranchTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.FastForward),
Expand All @@ -116,25 +116,25 @@ func (self *BranchesController) GetKeybindings(opts types.KeybindingsOpts) []*ty
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Handler: self.checkSelected(self.createResetMenu),
Description: self.c.Tr.Reset,
Tooltip: self.c.Tr.ResetTooltip,
OpensMenu: true,
Display: true,
Key: opts.GetKey(opts.Config.Commits.ViewResetOptions),
Handler: self.checkSelected(self.createResetMenu),
Description: self.c.Tr.Reset,
Tooltip: self.c.Tr.ResetTooltip,
OpensMenu: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Branches.RenameBranch),
Handler: self.checkSelectedAndReal(self.rename),
Description: self.c.Tr.RenameBranch,
},
{
Key: opts.GetKey(opts.Config.Branches.SetUpstream),
Handler: self.checkSelected(self.viewUpstreamOptions),
Description: self.c.Tr.Upstream,
Tooltip: self.c.Tr.ViewBranchUpstreamOptionsTooltip,
OpensMenu: true,
Display: true,
Key: opts.GetKey(opts.Config.Branches.SetUpstream),
Handler: self.checkSelected(self.viewUpstreamOptions),
Description: self.c.Tr.Upstream,
Tooltip: self.c.Tr.ViewBranchUpstreamOptionsTooltip,
OpensMenu: true,
DisplayOnscreen: true,
},
}
}
Expand Down
32 changes: 16 additions & 16 deletions pkg/gui/controllers/commits_files_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@ func NewCommitFilesController(
func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.CommitFiles.CheckoutCommitFile),
Handler: self.checkSelected(self.checkout),
Description: self.c.Tr.Checkout,
Tooltip: self.c.Tr.CheckoutCommitFileTooltip,
Display: true,
Key: opts.GetKey(opts.Config.CommitFiles.CheckoutCommitFile),
Handler: self.checkSelected(self.checkout),
Description: self.c.Tr.Checkout,
Tooltip: self.c.Tr.CheckoutCommitFileTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: self.checkSelected(self.discard),
Description: self.c.Tr.Remove,
Tooltip: self.c.Tr.DiscardOldFileChangeTooltip,
Display: true,
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: self.checkSelected(self.discard),
Description: self.c.Tr.Remove,
Tooltip: self.c.Tr.DiscardOldFileChangeTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Handler: self.checkSelected(self.open),
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
Display: true,
Key: opts.GetKey(opts.Config.Universal.OpenFile),
Handler: self.checkSelected(self.open),
Description: self.c.Tr.OpenFile,
Tooltip: self.c.Tr.OpenFileTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Edit),
Expand All @@ -63,7 +63,7 @@ func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []
Tooltip: utils.ResolvePlaceholderString(self.c.Tr.ToggleAddToPatchTooltip,
map[string]string{"doc": constants.Links.Docs.CustomPatchDemo},
),
Display: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleStagedAll),
Expand Down
16 changes: 8 additions & 8 deletions pkg/gui/controllers/confirmation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ func NewConfirmationController(
func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Confirm),
Handler: func() error { return self.context().State.OnConfirm() },
Description: self.c.Tr.Confirm,
Display: true,
Key: opts.GetKey(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),
Handler: func() error { return self.context().State.OnClose() },
Description: self.c.Tr.CloseCancel,
Display: true,
Key: opts.GetKey(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),
Expand Down
52 changes: 26 additions & 26 deletions pkg/gui/controllers/files_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ func NewFilesController(
func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
return []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Select),
Handler: self.checkSelectedFileNode(self.press),
Description: self.c.Tr.Stage,
Tooltip: self.c.Tr.StageTooltip,
Display: true,
Key: opts.GetKey(opts.Config.Universal.Select),
Handler: self.checkSelectedFileNode(self.press),
Description: self.c.Tr.Stage,
Tooltip: self.c.Tr.StageTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleStagedAll),
Handler: self.toggleStagedAll,
Description: self.c.Tr.ToggleStagedAll,
Tooltip: self.c.Tr.ToggleStagedAllTooltip,
Display: true,
Key: opts.GetKey(opts.Config.Files.ToggleStagedAll),
Handler: self.toggleStagedAll,
Description: self.c.Tr.ToggleStagedAll,
Tooltip: self.c.Tr.ToggleStagedAllTooltip,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.OpenStatusFilter),
Expand All @@ -53,11 +53,11 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.CommitChanges),
Handler: self.c.Helpers().WorkingTree.HandleCommitPress,
Description: self.c.Tr.Commit,
Tooltip: self.c.Tr.CommitTooltip,
Display: true,
Key: opts.GetKey(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),
Expand Down Expand Up @@ -98,11 +98,11 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
Description: self.c.Tr.RefreshFiles,
},
{
Key: opts.GetKey(opts.Config.Files.StashAllChanges),
Handler: self.stash,
Description: self.c.Tr.Stash,
Tooltip: self.c.Tr.StashTooltip,
Display: true,
Key: opts.GetKey(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),
Expand All @@ -124,12 +124,12 @@ func (self *FilesController) GetKeybindings(opts types.KeybindingsOpts) []*types
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Files.ViewResetOptions),
Handler: self.createResetMenu,
Description: self.c.Tr.Reset,
Tooltip: self.c.Tr.FileResetOptionsTooltip,
OpensMenu: true,
Display: true,
Key: opts.GetKey(opts.Config.Files.ViewResetOptions),
Handler: self.createResetMenu,
Description: self.c.Tr.Reset,
Tooltip: self.c.Tr.FileResetOptionsTooltip,
OpensMenu: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Files.ToggleTreeView),
Expand Down
12 changes: 6 additions & 6 deletions pkg/gui/controllers/files_remove_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func NewFilesRemoveController(
func (self *FilesRemoveController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
bindings := []*types.Binding{
{
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: self.checkSelectedFileNode(self.remove),
Description: self.c.Tr.Discard,
Tooltip: self.c.Tr.DiscardFileChangesTooltip,
Display: true,
OpensMenu: true,
Key: opts.GetKey(opts.Config.Universal.Remove),
Handler: self.checkSelectedFileNode(self.remove),
Description: self.c.Tr.Discard,
Tooltip: self.c.Tr.DiscardFileChangesTooltip,
DisplayOnscreen: true,
OpensMenu: true,
},
}

Expand Down
14 changes: 7 additions & 7 deletions pkg/gui/controllers/global_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
Description: self.c.Tr.OpenKeybindingsMenu,
Handler: self.createOptionsMenu,
ShortDescription: self.c.Tr.Keybindings,
Display: true,
DisplayOnscreen: true,
},
{
ViewName: "",
Expand All @@ -97,11 +97,11 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
OpensMenu: true,
},
{
Key: opts.GetKey(opts.Config.Universal.Quit),
Modifier: gocui.ModNone,
Description: self.c.Tr.Quit,
Display: true,
Handler: self.quit,
Key: opts.GetKey(opts.Config.Universal.Quit),
Modifier: gocui.ModNone,
Description: self.c.Tr.Quit,
DisplayOnscreen: true,
Handler: self.quit,
},
{
Key: opts.GetKey(opts.Config.Universal.QuitAlt1),
Expand All @@ -118,7 +118,7 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
Modifier: gocui.ModNone,
Handler: self.escape,
ShortDescription: self.c.Tr.Cancel,
Display: true,
DisplayOnscreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
Expand Down
Loading

0 comments on commit 110b025

Please sign in to comment.