diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-05-08 14:23:32 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-05-08 14:26:18 +1000 |
commit | 6f8063217ddf132dca36b75affaa7f7273f89d9d (patch) | |
tree | 871c1b76adf464b11fe04c43bbd2a4a7ac5d452e | |
parent | 125e948d82c33226f92a1ebe18361633116370d3 (diff) |
rename displayString to label for menu items
23 files changed, 126 insertions, 122 deletions
diff --git a/pkg/gui/context/menu_context.go b/pkg/gui/context/menu_context.go index be748eb70..b705adcee 100644 --- a/pkg/gui/context/menu_context.go +++ b/pkg/gui/context/menu_context.go @@ -58,7 +58,7 @@ func (self *MenuContext) GetSelectedItemId() string { return "" } - return item.DisplayString + return item.Label } type MenuViewModel struct { @@ -96,11 +96,11 @@ func (self *MenuViewModel) GetDisplayStrings(_startIdx int, _length int) [][]str } func getItemDisplayStrings(item *types.MenuItem) []string { - if item.DisplayStrings != nil { - return item.DisplayStrings + if item.LabelColumns != nil { + return item.LabelColumns } - styledStr := item.DisplayString + styledStr := item.Label if item.OpensMenu { styledStr = presentation.OpensMenuStyle(styledStr) } diff --git a/pkg/gui/controllers/basic_commits_controller.go b/pkg/gui/controllers/basic_commits_controller.go index 66455eecf..cecba00fe 100644 --- a/pkg/gui/controllers/basic_commits_controller.go +++ b/pkg/gui/controllers/basic_commits_controller.go @@ -101,35 +101,35 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e Title: self.c.Tr.Actions.CopyCommitAttributeToClipboard, Items: []*types.MenuItem{ { - DisplayString: self.c.Tr.LcCommitSha, + Label: self.c.Tr.LcCommitSha, OnPress: func() error { return self.copyCommitSHAToClipboard(commit) }, Key: 's', }, { - DisplayString: self.c.Tr.LcCommitURL, + Label: self.c.Tr.LcCommitURL, OnPress: func() error { return self.copyCommitURLToClipboard(commit) }, Key: 'u', }, { - DisplayString: self.c.Tr.LcCommitDiff, + Label: self.c.Tr.LcCommitDiff, OnPress: func() error { return self.copyCommitDiffToClipboard(commit) }, Key: 'd', }, { - DisplayString: self.c.Tr.LcCommitMessage, + Label: self.c.Tr.LcCommitMessage, OnPress: func() error { return self.copyCommitMessageToClipboard(commit) }, Key: 'm', }, { - DisplayString: self.c.Tr.LcCommitAuthor, + Label: self.c.Tr.LcCommitAuthor, OnPress: func() error { return self.copyAuthorToClipboard(commit) }, diff --git a/pkg/gui/controllers/bisect_controller.go b/pkg/gui/controllers/bisect_controller.go index 168076135..805911030 100644 --- a/pkg/gui/controllers/bisect_controller.go +++ b/pkg/gui/controllers/bisect_controller.go @@ -67,7 +67,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c menuItems := []*types.MenuItem{ { - DisplayString: fmt.Sprintf(self.c.Tr.Bisect.Mark, commit.ShortSha(), info.NewTerm()), + Label: fmt.Sprintf(self.c.Tr.Bisect.Mark, commit.ShortSha(), info.NewTerm()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.BisectMark) if err := self.git.Bisect.Mark(commit.Sha, info.NewTerm()); err != nil { @@ -79,7 +79,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Key: 'b', }, { - DisplayString: fmt.Sprintf(self.c.Tr.Bisect.Mark, commit.ShortSha(), info.OldTerm()), + Label: fmt.Sprintf(self.c.Tr.Bisect.Mark, commit.ShortSha(), info.OldTerm()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.BisectMark) if err := self.git.Bisect.Mark(commit.Sha, info.OldTerm()); err != nil { @@ -91,7 +91,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Key: 'g', }, { - DisplayString: fmt.Sprintf(self.c.Tr.Bisect.Skip, commit.ShortSha()), + Label: fmt.Sprintf(self.c.Tr.Bisect.Skip, commit.ShortSha()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.BisectSkip) if err := self.git.Bisect.Skip(commit.Sha); err != nil { @@ -103,7 +103,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c Key: 's', }, { - DisplayString: self.c.Tr.Bisect.ResetOption, + Label: self.c.Tr.Bisect.ResetOption, OnPress: func() error { return self.helpers.Bisect.Reset() }, @@ -122,7 +122,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo, Title: self.c.Tr.Bisect.BisectMenuTitle, Items: []*types.MenuItem{ { - DisplayString: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortSha(), info.NewTerm()), + Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortSha(), info.NewTerm()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.StartBisect) if err := self.git.Bisect.Start(); err != nil { @@ -138,7 +138,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo, Key: 'b', }, { - DisplayString: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortSha(), info.OldTerm()), + Label: fmt.Sprintf(self.c.Tr.Bisect.MarkStart, commit.ShortSha(), info.OldTerm()), OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.StartBisect) if err := self.git.Bisect.Start(); err != nil { diff --git a/pkg/gui/controllers/branches_controller.go b/pkg/gui/controllers/branches_controller.go index 096082ac4..6b86dfcd3 100644 --- a/pkg/gui/controllers/branches_controller.go +++ b/pkg/gui/controllers/branches_controller.go @@ -111,7 +111,7 @@ func (self *BranchesController) setUpstream(selectedBranch *models.Branch) error Title: self.c.Tr.Actions.SetUnsetUpstream, Items: []*types.MenuItem{ { - DisplayStrings: []string{self.c.Tr.LcUnsetUpstream}, + LabelColumns: []string{self.c.Tr.LcUnsetUpstream}, OnPress: func() error { if err := self.git.Branch.UnsetUpstream(selectedBranch.Name); err != nil { return self.c.Error(err) @@ -130,7 +130,7 @@ func (self *BranchesController) setUpstream(selectedBranch *models.Branch) error Key: 'u', }, { - DisplayStrings: []string{self.c.Tr.LcSetUpstream}, + LabelColumns: []string{self.c.Tr.LcSetUpstream}, OnPress: func() error { return self.helpers.Upstream.PromptForUpstreamWithoutInitialContent(selectedBranch, func(upstream string) error { upstreamRemote, upstreamBranch, err := self.helpers.Upstream.ParseUpstream(upstream) @@ -417,20 +417,20 @@ func (self *BranchesController) newBranch(selectedBranch *models.Branch) error { func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Branch, checkedOutBranch *models.Branch) error { menuItems := make([]*types.MenuItem, 0, 4) - fromToDisplayStrings := func(from string, to string) []string { + fromToLabelColumns := func(from string, to string) []string { return []string{fmt.Sprintf("%s → %s", from, to)} } menuItemsForBranch := func(branch *models.Branch) []*types.MenuItem { return []*types.MenuItem{ { - DisplayStrings: fromToDisplayStrings(branch.Name, self.c.Tr.LcDefaultBranch), + LabelColumns: fromToLabelColumns(branch.Name, self.c.Tr.LcDefaultBranch), OnPress: func() error { return self.createPullRequest(branch.Name, "") }, }, { - DisplayStrings: fromToDisplayStrings(branch.Name, self.c.Tr.LcSelectBranch), + LabelColumns: fromToLabelColumns(branch.Name, self.c.Tr.LcSelectBranch), OnPress: func() error { return self.c.Prompt(types.PromptOpts{ Title: branch.Name + " →", @@ -447,7 +447,7 @@ func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Bra if selectedBranch != checkedOutBranch { menuItems = append(menuItems, &types.MenuItem{ - DisplayStrings: fromToDisplayStrings(checkedOutBranch.Name, selectedBranch.Name), + LabelColumns: fromToLabelColumns(checkedOutBranch.Name, selectedBranch.Name), OnPress: func() error { return self.createPullRequest(checkedOutBranch.Name, selectedBranch.Name) }, diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index 26c6e131f..c461af919 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -500,19 +500,19 @@ func (self *FilesController) handleStatusFilterPressed() error { Title: self.c.Tr.FilteringMenuTitle, Items: []*types.MenuItem{ { - DisplayString: self.c.Tr.FilterStagedFiles, + Label: self.c.Tr.FilterStagedFiles, OnPress: func() error { return self.setStatusFiltering(filetree.DisplayStaged) }, }, { - DisplayString: self.c.Tr.FilterUnstagedFiles, + Label: self.c.Tr.FilterUnstagedFiles, OnPress: func() error { return self.setStatusFiltering(filetree.DisplayUnstaged) }, }, { - DisplayString: self.c.Tr.ResetCommitFilterState, + Label: self.c.Tr.ResetCommitFilterState, OnPress: func() error { return self.setStatusFiltering(filetree.DisplayAll) }, @@ -557,14 +557,14 @@ func (self *FilesController) createStashMenu() error { Title: self.c.Tr.LcStashOptions, Items: []*types.MenuItem{ { - DisplayString: self.c.Tr.LcStashAllChanges, + Label: self.c.Tr.LcStashAllChanges, OnPress: func() error { return self.handleStashSave(self.git.Stash.Save, self.c.Tr.Actions.StashAllChanges, self.c.Tr.NoFilesToStash) }, Key: 'a', }, { - DisplayString: self.c.Tr.LcStashAllChangesKeepIndex, + Label: self.c.Tr.LcStashAllChangesKeepIndex, OnPress: func() error { // if there are no staged files it behaves the same as Stash.Save return self.handleStashSave(self.git.Stash.StashAndKeepIndex, self.c.Tr.Actions.StashAllChangesKeepIndex, self.c.Tr.NoFilesToStash) @@ -572,7 +572,7 @@ func (self *FilesController) createStashMenu() error { Key: 'i', }, { - DisplayString: self.c.Tr.LcStashStagedChanges, + Label: self.c.Tr.LcStashStagedChanges, OnPress: func() error { // there must be something in staging otherwise the current implementation mucks the stash up if !self.helpers.WorkingTree.AnyStagedFiles() { @@ -583,7 +583,7 @@ func (self *FilesController) createStashMenu() error { Key: 's', }, { - DisplayString: self.c.Tr.LcStashUnstagedChanges, + Label: self.c.Tr.LcStashUnstagedChanges, OnPress: func() error { if self.helpers.WorkingTree.AnyStagedFiles() { return self.handleStashSave(self.git.Stash.StashUnstagedChanges, self.c.Tr.Actions.StashUnstagedChanges, self.c.Tr.NoFilesToStash) diff --git a/pkg/gui/controllers/files_remove_controller.go b/pkg/gui/controllers/files_remove_controller.go index 54af72fa0..73449f1ec 100644 --- a/pkg/gui/controllers/files_remove_controller.go +++ b/pkg/gui/controllers/files_remove_controller.go @@ -43,7 +43,7 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error { if node.File == nil { menuItems = []*types.MenuItem{ { - DisplayString: self.c.Tr.LcDiscardAllChanges, + Label: self.c.Tr.LcDiscardAllChanges, OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.DiscardAllChangesInDirectory) if err := self.git.WorkingTree.DiscardAllDirChanges(node); err != nil { @@ -57,7 +57,7 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error { if node.GetHasStagedChanges() && node.GetHasUnstagedChanges() { menuItems = append(menuItems, &types.MenuItem{ - DisplayString: self.c.Tr.LcDiscardUnstagedChanges, + Label: self.c.Tr.LcDiscardUnstagedChanges, OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.DiscardUnstagedChangesInDirectory) if err := self.git.WorkingTree.DiscardUnstagedDirChanges(node); err != nil { @@ -78,7 +78,7 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error { menuItems = []*types.MenuItem{ { - DisplayString: self.c.Tr.LcSubmoduleStashAndReset, + Label: self.c.Tr.LcSubmoduleStashAndReset, OnPress: func() error { return self.ResetSubmodule(submodule) }, @@ -87,7 +87,7 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error { } else { menuItems = []*types.MenuItem{ { - DisplayString: self.c.Tr.LcDiscardAllChanges, + Label: self.c.Tr.LcDiscardAllChanges, OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.DiscardAllChangesInFile) if err := self.git.WorkingTree.DiscardAllFileChanges(file); err != nil { @@ -101,7 +101,7 @@ func (self *FilesRemoveController) remove(node *filetree.FileNode) error { if file.HasStagedChanges && file.HasUnstagedChanges { menuItems = append(menuItems, &types.MenuItem{ - DisplayString: self.c.Tr.LcDiscardUnstagedChanges, + Label: self.c.Tr.LcDiscardUnstagedChanges, OnPress: func() error { self.c.LogAction(self.c.Tr.Actions.DiscardAllUnstagedChangesInFile) if err := self.git.WorkingTree.DiscardUnstagedFileChanges(file); err != nil { diff --git a/pkg/gui/controllers/git_flow_controller.go b/pkg/gui/controllers/git_flow_controller.go index a0b0f3074..2504ad2dd 100644 --- a/pkg/gui/controllers/git_flow_controller.go +++ b/pkg/gui/controllers/git_flow_controller.go @@ -64,30 +64,30 @@ func (self *GitFlowController) handleCreateGitFlowMenu(branch *models.Branch) er Items: []*types.MenuItem{ { // not localising here because it's one to one with the actual git flow commands - DisplayString: fmt.Sprintf("finish branch '%s'", branch.Name), + Label: fmt.Sprintf("finish branch '%s'", branch.Name), OnPress: func() error { return self.gitFlowFinishBranch(branch.Name) }, }, { - DisplayString: "start feature", - OnPress: startHandler("feature"), - Key: 'f', + Label: "start feature", + OnPress: startHandler("feature"), + Key: 'f', }, { - DisplayString: "start hotfix", - OnPress: startHandler("hotfix"), - Key: 'h', + Label: "start hotfix", + OnPress: startHandler("hotfix"), + Key: 'h', }, { - DisplayString: "start bugfix", - OnPress: startHandler("bugfix"), - Key: 'b', + Label: "start bugfix", + OnPress: startHandler("bugfix"), + Key: 'b', }, { - DisplayString: "start release", - OnPress: startHandler("release"), - Key: 'r', + Label: "start release", + OnPress: startHandler("release"), + Key: 'r', }, }, }) diff --git a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go index 4484e4fc8..ef9dd76a2 100644 --- a/pkg/gui/controllers/helpers/merge_and_rebase_helper.go +++ b/pkg/gui/controllers/helpers/merge_and_rebase_helper.go @@ -64,7 +64,7 @@ func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error { menuItems := slices.Map(options, func(row optionAndKey) *types.MenuItem { return &types.MenuItem{ - DisplayString: row.option, + Label: row.option, OnPress: func() error { return self.genericMergeCommand(row.option) }, diff --git a/pkg/gui/controllers/helpers/refs_helper.go b/pkg/gui/controllers/helpers/refs_helper.go index d96fa795b..7630349ec 100644 --- a/pkg/gui/controllers/helpers/refs_helper.go +++ b/pkg/gui/controllers/helpers/refs_helper.go @@ -146,7 +146,7 @@ func (self *RefsHelper) CreateGitResetMenu(ref string) error { menuItems := slices.Map(strengths, func(row strengthWithKey) *types.MenuItem { return &types.MenuItem{ - DisplayStrings: []string{ + LabelColumns: []string{ fmt.Sprintf("%s reset", row.strength), style.FgRed.Sprintf("reset --%s %s", row.strength, ref), }, diff --git a/pkg/gui/controllers/helpers/tags_helper.go b/pkg/gui/controllers/helpers/tags_helper.go index d2e92cd24..4683ffd0d 100644 --- a/pkg/gui/controllers/helpers/tags_helper.go +++ b/pkg/gui/controllers/helpers/tags_helper.go @@ -26,13 +26,13 @@ func (self *TagsHelper) CreateTagMenu(commitSha string, onCreate func()) error { Title: self.c.Tr.TagMenuTitle, Items: []*types.MenuItem{ { - DisplayString: self.c.Tr.LcLightweightTag, + Label: self.c.Tr.LcLightweightTag, OnPress: func() error { return self.handleCreateLightweightTag(commitSha, onCreate) }, }, { - DisplayString: self.c.Tr.LcAnnotatedTag, + Label: self.c.Tr.LcAnnotatedTag, OnPress: func() error { return self.handleCreateAnnotatedTag(commitSha, onCreate) }, diff --git a/pkg/gui/controllers/local_commits_controller.go b/pkg/gui/controllers/local_commits_controller.go index 7684d6469..7d0f144cd 100644 --- a/pkg/gui/controllers/local_commits_controller.go +++ b/pkg/gui/controllers/local_commits_controller.go @@ -470,7 +470,7 @@ func (self *LocalCommitsController) createRevertMergeCommitMenu(commit *models.C } menuItems[i] = &types.MenuItem{ - DisplayString: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message), + Label: fmt.Sprintf("%s: %s", utils.SafeTruncate(parentSha, 8), message), OnPress: func() error { parentNumber := i + 1 self.c.LogAction(self.c.Tr.Actions.RevertCommit) @@ -570,7 +570,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { Title: self.c.Tr.LogMenuTitle, Items: []*types.MenuItem{ { - DisplayString: self.c.Tr.ToggleShowGitGraphAll, + Label: self.c.Tr.ToggleShowGitGraphAll, OnPress: func() error { self.context().SetShowWholeGitGraph(!self.context().GetShowWholeGitGraph()) @@ -586,8 +586,8 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { }, }, { - DisplayString: self.c.Tr.ShowGitGraph, - OpensMenu: true, + Label: self.c.Tr.ShowGitGraph, + OpensMenu: true, OnPress: func() error { onPress := func(value string) func() error { return func() error { @@ -599,24 +599,24 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { Title: self.c.Tr.LogMenuTitle, Items: []*types.MenuItem{ { - DisplayString: "always", - OnPress: onPress("always"), + Label: "always", + OnPress: onPress("always"), }, { - DisplayString: "never", - OnPress: onPress("never"), + Label: "never", + OnPress: onPress("never"), }, { - DisplayString: "when maximised", - OnPress: onPress("when-maximised"), + Label: "when maximised", + OnPress: onPress("when-maximised"), }, }, }) }, }, { - DisplayString: self.c.Tr.SortCommits, - OpensMenu: true, + Label: self.c.Tr.SortCommits, + OpensMenu: true, OnPress: func() error { onPress := func(value string) func() error { return func() error { @@ -636,16 +636,16 @@ func (self *LocalCommitsController) handleOpenLogMenu() error { Title: self.c.Tr.LogMenuTitle, Items: []*types.MenuItem{ { - DisplayString: "topological (topo-order)", - OnPress: onPress("topo-order"), + Label: "topological (topo-order)", + OnPress: onPress("topo-order"), }, { - DisplayString: "date-order", - OnPress: onPress("date-order"), + Label: "date-order", + OnPress: onPress("date-order"), }, { - DisplayString: "author-date-order", - OnPress: onPress("author-date-order"), + Label: "author-date-order", + OnPress: onPress("author-date-order"), }, }, }) diff --git a/pkg/gui/controllers/submodules_controller.go b/pkg/gui/controllers/submodules_controller.go index b0a8f6116..5bd7ce088 100644 --- a/pkg/gui/controllers/submodules_controller.go +++ b/pkg/gui/controllers/submodules_controller.go @@ -146,7 +146,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error { Title: self.c.Tr.LcBulkSubmoduleOptions, Items: []*types.MenuItem{ { - DisplayStrings: []string{self.c.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(self.git.Submodule.BulkInitCmdObj().ToString())}, + LabelColumns: []string{self.c.Tr.LcBulkInitSubmodules, style.FgGreen.Sprint(self.git.Submodule.BulkInitCmdObj().ToString())}, OnPress: func() error { return self.c.WithWaitingStatus(self.c.Tr.LcRunningCommand, func() error { self.c.LogAction(self.c.Tr.Actions.BulkInitialiseSubmodules) @@ -161,7 +161,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error { Key: 'i', }, { - DisplayStrings: []string{self.c.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(self.git.Submodule.BulkUpdateCmdObj().ToString())}, + LabelColumns: []string{self.c.Tr.LcBulkUpdateSubmodules, style.FgYellow.Sprint(self.git.Submodule.BulkUpdateCmdObj().ToString())}, OnPress: func() error { return self.c.WithWaitingStatus(self.c.Tr.LcRunningCommand, func() error { self.c.LogAction(self.c.Tr.Actions.BulkUpdateSubmodules) @@ -175,7 +175,7 @@ func (self *SubmodulesController) openBulkActionsMenu() error { Key: 'u', }, { - DisplayStrings: []string{self.c.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(self.git.Submodule.BulkDeinitCmdObj().ToString())}, + LabelColumns: []string{self.c.Tr.LcBulkDeinitSubmodules, style.FgRed.Sprint(self.git.Submodule.BulkDeinitCmdObj().ToString())}, OnPress: func() error { return self.c.WithWaitingStatus(self.c.Tr.LcRunningCommand, func() error { self.c.LogAction(self.c.Tr.Actions.BulkDeinitialiseSubmodules) diff --git a/pkg/gui/controllers/workspace_reset_controller.go b/pkg/gui/controllers/workspace_reset_controller.go index bd5f47195..dc830b3ba 100644 --- a/pkg/gui/controllers/workspace_reset_controller.go +++ b/pkg/gui/controllers/workspace_reset_controller.go @@ -19,7 +19,7 @@ func (self *FilesController) createResetMenu() error { menuItems := []*types.MenuItem{ { - DisplayStrings: []string{ + LabelColumns: []string{ self.c.Tr.LcDiscardAllChangesToAllFiles, red.Sprint(nukeStr), }, @@ -35,7 +35,7 @@ func (self *FilesController) createResetMenu() error { Tooltip: self.c.Tr.NukeDescription, }, { - DisplayStrings: []string{ + LabelColumns: []string{ self.c.Tr.LcDiscardAnyUnstagedChanges, red.Sprint("git checkout -- ."), }, @@ -50,7 +50,7 @@ func (self *FilesController) createResetMenu() error { Key: 'u', }, { - DisplayStrings: []string{ + LabelColumns: []string{ self.c.Tr.LcDiscardUntrackedFiles, red.Sprint("git clean -fd"), }, @@ -65,7 +65,7 @@ func (self *FilesController) createResetMenu() error { Key: 'c', }, { - DisplayStrings: []string{ + LabelColumns: []string{ self.c.Tr.LcSoftReset, red.Sprint("git reset --soft HEAD"), }, @@ -80,7 +80,7 @@ func (self *FilesController) createResetMenu() error { Key: 's', }, { - DisplayStrings: []string{ + LabelColumns: []string{ "mixed reset", red.Sprint("git reset --mixed HEAD"), }, @@ -95,7 +95,7 @@ func (self *FilesController) createResetMenu() error { Key: 'm', }, { - DisplayStrings: []string{ + LabelColumns: []string{ self.c.Tr.LcHardReset, red.Sprint("git reset --hard HEAD"), }, diff --git a/pkg/gui/diffing.go b/pkg/gui/diffing.go index 6e1b2bdeb..7653550de 100644 --- a/pkg/gui/diffing.go +++ b/pkg/gui/diffing.go @@ -112,7 +112,7 @@ func (gui *Gui) handleCreateDiffingMenuPanel() error { name := name menuItems = append(menuItems, []*types.MenuItem{ { - DisplayString: fmt.Sprintf("%s %s", gui.c.Tr.LcDiff, name), + Label: fmt.Sprintf("%s %s", gui.c.Tr.LcDiff, name), OnPress: func() error { gui.State.Modes.Diffing.Ref = name // can scope this down based on current view but too lazy right now @@ -124,7 +124,7 @@ func (gui *Gui) handleCreateDiffingMenuPanel() error { menuItems = append(menuItems, []*types.MenuItem{ { - DisplayString: gui.c.Tr.LcEnterRefToDiff, + Label: gui.c.Tr.LcEnterRefToDiff, OnPress: func() error { return gui.c.Prompt(types.PromptOpts{ Title: gui.c.Tr.LcEnteRefName, @@ -141,14 +141,14 @@ func (gui *Gui) handleCreateDiffingMenuPanel() error { if gui.State.Modes.Diffing.Active() { menuItems = append(menuItems, []*types.MenuItem{ { - DisplayString: gui.c.Tr.LcSwapDiff, + Label: gui.c.Tr.LcSwapDiff, OnPress: func() error { gui.State.Modes.Diffing.Reverse = !gui.State.Modes.Diffing.Reverse return gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) }, }, { - DisplayString: gui.c.Tr.LcExitDiffMode, + Label: gui.c.Tr.LcExitDiffMode, OnPress: func() error { gui.State.Modes.Diffing = diffing.New() return gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) diff --git a/pkg/gui/extras_panel.go b/pkg/gui/extras_panel.go index 6033f8516..c36f12a66 100644 --- a/pkg/gui/extras_panel.go +++ b/pkg/gui/extras_panel.go @@ -13,7 +13,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error { Title: gui.c.Tr.CommandLog, Items: []*types.MenuItem{ { - DisplayString: gui.c.Tr.ToggleShowCommandLog, + Label: gui.c.Tr.ToggleShowCommandLog, OnPress: func() error { currentContext := gui.currentStaticContext() if gui.ShowExtrasWindow && currentContext.GetKey() == context.COMMAND_LOG_CONTEXT_KEY { @@ -29,8 +29,8 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error { }, }, { - DisplayString: gui.c.Tr.FocusCommandLog, - OnPress: gui.handleFocusCommandLog, + Label: gui.c.Tr.FocusCommandLog, + OnPress: gui.handleFocusCommandLog, }, }, }) diff --git a/pkg/gui/filtering_menu_panel.go b/pkg/gui/filtering_menu_panel.go index 7bcc26363..97327324e 100644 --- a/pkg/gui/filtering_menu_panel.go +++ b/pkg/gui/filtering_menu_panel.go @@ -26,7 +26,7 @@ func (gui *Gui) handleCreateFilteringMenuPanel() error { if fileName != "" { menuItems = append(menuItems, &types.MenuItem{ - DisplayString: fmt.Sprintf("%s '%s'", gui.c.Tr.LcFilterBy, fileName), + Label: fmt.Sprintf("%s '%s'", gui.c.Tr.LcFilterBy, fileName), OnPress: func() error { return gui.setFiltering(fileName) }, @@ -34,7 +34,7 @@ func (gui *Gui) handleCreateFilteringMenuPanel() error { } menuItems = append(menuItems, &types.MenuItem{ - DisplayString: gui.c.Tr.LcFilterPathOption, + Label: gui.c.Tr.LcFilterPathOption, OnPress: func() error { return gui.c.Prompt(types.PromptOpts{ FindSuggestionsFunc: gui.helpers.Suggestions.GetFilePathSuggestionsFunc(), @@ -48,8 +48,8 @@ func (gui *Gui) handleCreateFilteringMenuPanel() error { if gui.State.Modes.Filtering.Active() { menuItems = append(menuItems, &types.MenuItem{ - DisplayString: gui.c.Tr.LcExitFilterMode, - OnPress: gui.clearFiltering, + Label: gui.c.Tr.LcExitFilterMode, + OnPress: gui.clearFiltering, }) } diff --git a/pkg/gui/menu_panel.go b/pkg/gui/menu_panel.go index 459fd60ce..59dd6b3a5 100644 --- a/pkg/gui/menu_panel.go +++ b/pkg/gui/menu_panel.go @@ -23,7 +23,7 @@ func (gui *Gui) createMenu(opts types.CreateMenuOptions) error { if !opts.HideCancel { // this is mutative but I'm okay with that for now opts.Items = append(opts.Items, &types.MenuItem{ - DisplayStrings: []string{gui.c.Tr.LcCancel}, + LabelColumns: []string{gui.c.Tr.LcCancel}, OnPress: func() error { return nil }, @@ -31,7 +31,7 @@ func (gui *Gui) createMenu(opts types.CreateMenuOptions) error { } for _, item := range opts.Items { - if item.OpensMenu && item.DisplayStrings != nil { + if item.OpensMenu && item.LabelColumns != nil { return errors.New("Message for the developer of this app: you've set opensMenu with displaystrings on the me |