Skip to content

Commit

Permalink
Add tooltips to custom patch menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Jan 7, 2024
1 parent c859d0c commit 82ce786
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 133 deletions.
7 changes: 7 additions & 0 deletions pkg/gui/controllers/custom_patch_options_menu_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
menuItems := []*types.MenuItem{
{
Label: self.c.Tr.ResetPatch,
Tooltip: self.c.Tr.ResetPatchTooltip,
OnPress: self.c.Helpers().PatchBuilding.Reset,
Key: 'c',
},
{
Label: self.c.Tr.ApplyPatch,
Tooltip: self.c.Tr.ApplyPatchTooltip,
OnPress: func() error { return self.handleApplyPatch(false) },
Key: 'a',
},
{
Label: self.c.Tr.ApplyPatchInReverse,
Tooltip: self.c.Tr.ApplyPatchInReverseTooltip,
OnPress: func() error { return self.handleApplyPatch(true) },
Key: 'r',
},
Expand All @@ -44,16 +47,19 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
menuItems = append(menuItems, []*types.MenuItem{
{
Label: fmt.Sprintf(self.c.Tr.RemovePatchFromOriginalCommit, self.c.Git().Patch.PatchBuilder.To),
Tooltip: self.c.Tr.RemovePatchFromOriginalCommitTooltip,
OnPress: self.handleDeletePatchFromCommit,
Key: 'd',
},
{
Label: self.c.Tr.MovePatchOutIntoIndex,
Tooltip: self.c.Tr.MovePatchOutIntoIndexTooltip,
OnPress: self.handleMovePatchIntoWorkingTree,
Key: 'i',
},
{
Label: self.c.Tr.MovePatchIntoNewCommit,
Tooltip: self.c.Tr.MovePatchIntoNewCommitTooltip,
OnPress: self.handlePullPatchIntoNewCommit,
Key: 'n',
},
Expand All @@ -69,6 +75,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error {
[]*types.MenuItem{
{
Label: fmt.Sprintf(self.c.Tr.MovePatchToSelectedCommit, selectedCommit.Sha),
Tooltip: self.c.Tr.MovePatchToSelectedCommitTooltip,
OnPress: self.handleMovePatchToSelectedCommit,
Key: 'm',
},
Expand Down
280 changes: 147 additions & 133 deletions pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,139 +590,146 @@ type TranslationSet struct {
NavigationTitle string
SuggestionsCheatsheetTitle string
// Unlike the cheatsheet title above, the real suggestions title has a little message saying press tab to focus
SuggestionsTitle string
ExtrasTitle string
PushingTagStatus string
PullRequestURLCopiedToClipboard string
CommitDiffCopiedToClipboard string
CommitSHACopiedToClipboard string
CommitURLCopiedToClipboard string
CommitMessageCopiedToClipboard string
CommitAuthorCopiedToClipboard string
PatchCopiedToClipboard string
CopiedToClipboard string
ErrCannotEditDirectory string
ErrStageDirWithInlineMergeConflicts string
ErrRepositoryMovedOrDeleted string
ErrWorktreeMovedOrRemoved string
CommandLog string
ToggleShowCommandLog string
FocusCommandLog string
CommandLogHeader string
RandomTip string
SelectParentCommitForMerge string
ToggleWhitespaceInDiffView string
ToggleWhitespaceInDiffViewTooltip string
IgnoreWhitespaceDiffViewSubTitle string
IgnoreWhitespaceNotSupportedHere string
IncreaseContextInDiffView string
IncreaseContextInDiffViewTooltip string
DecreaseContextInDiffView string
DecreaseContextInDiffViewTooltip string
DiffContextSizeChanged string
CreatePullRequestOptions string
DefaultBranch string
SelectBranch string
CreatePullRequest string
SelectConfigFile string
NoConfigFileFoundErr string
LoadingFileSuggestions string
LoadingCommits string
MustSpecifyOriginError string
GitOutput string
GitCommandFailed string
AbortTitle string
AbortPrompt string
OpenLogMenu string
OpenLogMenuTooltip string
LogMenuTitle string
ToggleShowGitGraphAll string
ShowGitGraph string
SortOrder string
SortAlphabetical string
SortByDate string
SortByRecency string
SortBasedOnReflog string
SortCommits string
CantChangeContextSizeError string
OpenCommitInBrowser string
ViewBisectOptions string
ConfirmRevertCommit string
RewordInEditorTitle string
RewordInEditorPrompt string
CheckoutPrompt string
HardResetAutostashPrompt string
UpstreamGone string
NukeDescription string
DiscardStagedChangesDescription string
EmptyOutput string
Patch string
CustomPatch string
CommitsCopied string
CommitCopied string
ResetPatch string
ApplyPatch string
ApplyPatchInReverse string
RemovePatchFromOriginalCommit string
MovePatchOutIntoIndex string
MovePatchIntoNewCommit string
MovePatchToSelectedCommit string
CopyPatchToClipboard string
NoMatchesFor string
MatchesFor string
SearchKeybindings string
SearchPrefix string
FilterPrefix string
ExitSearchMode string
ExitTextFilterMode string
Switch string
SwitchToWorktreeTooltip string
AlreadyCheckedOutByWorktree string
BranchCheckedOutByWorktree string
DetachWorktreeTooltip string
Switching string
RemoveWorktree string
RemoveWorktreeTitle string
DetachWorktree string
DetachingWorktree string
WorktreesTitle string
WorktreeTitle string
RemoveWorktreePrompt string
ForceRemoveWorktreePrompt string
RemovingWorktree string
AddingWorktree string
CantDeleteCurrentWorktree string
AlreadyInWorktree string
CantDeleteMainWorktree string
NoWorktreesThisRepo string
MissingWorktree string
MainWorktree string
NewWorktree string
NewWorktreePath string
NewWorktreeBase string
RemoveWorktreeTooltip string
BranchNameCannotBeBlank string
NewBranchName string
NewBranchNameLeaveBlank string
ViewWorktreeOptions string
CreateWorktreeFrom string
CreateWorktreeFromDetached string
LcWorktree string
ChangingDirectoryTo string
Name string
Branch string
Path string
MarkedBaseCommitStatus string
MarkAsBaseCommit string
MarkAsBaseCommitTooltip string
MarkedCommitMarker string
PleaseGoToURL string
DisabledMenuItemPrefix string
NoCommitSelected string
NoCopiedCommits string
Actions Actions
Bisect Bisect
Log Log
SuggestionsTitle string
ExtrasTitle string
PushingTagStatus string
PullRequestURLCopiedToClipboard string
CommitDiffCopiedToClipboard string
CommitSHACopiedToClipboard string
CommitURLCopiedToClipboard string
CommitMessageCopiedToClipboard string
CommitAuthorCopiedToClipboard string
PatchCopiedToClipboard string
CopiedToClipboard string
ErrCannotEditDirectory string
ErrStageDirWithInlineMergeConflicts string
ErrRepositoryMovedOrDeleted string
ErrWorktreeMovedOrRemoved string
CommandLog string
ToggleShowCommandLog string
FocusCommandLog string
CommandLogHeader string
RandomTip string
SelectParentCommitForMerge string
ToggleWhitespaceInDiffView string
ToggleWhitespaceInDiffViewTooltip string
IgnoreWhitespaceDiffViewSubTitle string
IgnoreWhitespaceNotSupportedHere string
IncreaseContextInDiffView string
IncreaseContextInDiffViewTooltip string
DecreaseContextInDiffView string
DecreaseContextInDiffViewTooltip string
DiffContextSizeChanged string
CreatePullRequestOptions string
DefaultBranch string
SelectBranch string
CreatePullRequest string
SelectConfigFile string
NoConfigFileFoundErr string
LoadingFileSuggestions string
LoadingCommits string
MustSpecifyOriginError string
GitOutput string
GitCommandFailed string
AbortTitle string
AbortPrompt string
OpenLogMenu string
OpenLogMenuTooltip string
LogMenuTitle string
ToggleShowGitGraphAll string
ShowGitGraph string
SortOrder string
SortAlphabetical string
SortByDate string
SortByRecency string
SortBasedOnReflog string
SortCommits string
CantChangeContextSizeError string
OpenCommitInBrowser string
ViewBisectOptions string
ConfirmRevertCommit string
RewordInEditorTitle string
RewordInEditorPrompt string
CheckoutPrompt string
HardResetAutostashPrompt string
UpstreamGone string
NukeDescription string
DiscardStagedChangesDescription string
EmptyOutput string
Patch string
CustomPatch string
CommitsCopied string
CommitCopied string
ResetPatch string
ResetPatchTooltip string
ApplyPatch string
ApplyPatchTooltip string
ApplyPatchInReverse string
ApplyPatchInReverseTooltip string
RemovePatchFromOriginalCommit string
RemovePatchFromOriginalCommitTooltip string
MovePatchOutIntoIndex string
MovePatchOutIntoIndexTooltip string
MovePatchIntoNewCommit string
MovePatchIntoNewCommitTooltip string
MovePatchToSelectedCommit string
MovePatchToSelectedCommitTooltip string
CopyPatchToClipboard string
NoMatchesFor string
MatchesFor string
SearchKeybindings string
SearchPrefix string
FilterPrefix string
ExitSearchMode string
ExitTextFilterMode string
Switch string
SwitchToWorktreeTooltip string
AlreadyCheckedOutByWorktree string
BranchCheckedOutByWorktree string
DetachWorktreeTooltip string
Switching string
RemoveWorktree string
RemoveWorktreeTitle string
DetachWorktree string
DetachingWorktree string
WorktreesTitle string
WorktreeTitle string
RemoveWorktreePrompt string
ForceRemoveWorktreePrompt string
RemovingWorktree string
AddingWorktree string
CantDeleteCurrentWorktree string
AlreadyInWorktree string
CantDeleteMainWorktree string
NoWorktreesThisRepo string
MissingWorktree string
MainWorktree string
NewWorktree string
NewWorktreePath string
NewWorktreeBase string
RemoveWorktreeTooltip string
BranchNameCannotBeBlank string
NewBranchName string
NewBranchNameLeaveBlank string
ViewWorktreeOptions string
CreateWorktreeFrom string
CreateWorktreeFromDetached string
LcWorktree string
ChangingDirectoryTo string
Name string
Branch string
Path string
MarkedBaseCommitStatus string
MarkAsBaseCommit string
MarkAsBaseCommitTooltip string
MarkedCommitMarker string
PleaseGoToURL string
DisabledMenuItemPrefix string
NoCommitSelected string
NoCopiedCommits string
Actions Actions
Bisect Bisect
Log Log
}

type Bisect struct {
Expand Down Expand Up @@ -1561,12 +1568,19 @@ func EnglishTranslationSet() TranslationSet {
CommitsCopied: "commits copied", // lowercase because it's used in a sentence
CommitCopied: "commit copied", // lowercase because it's used in a sentence
ResetPatch: "Reset patch",
ResetPatchTooltip: "Clear the current patch.",
ApplyPatch: "Apply patch",
ApplyPatchTooltip: "Apply the current patch to the working tree.",
ApplyPatchInReverse: "Apply patch in reverse",
ApplyPatchInReverseTooltip: "Apply the current patch in reverse to the working tree.",
RemovePatchFromOriginalCommit: "Remove patch from original commit (%s)",
RemovePatchFromOriginalCommitTooltip: "Remove the current patch from its commit. This is achieved by starting an interactive rebase at the commit, applying the patch in reverse, and then continuing the rebase. If later commits depend on the patch, you may need to resolve conflicts.",
MovePatchOutIntoIndex: "Move patch out into index",
MovePatchOutIntoIndexTooltip: "Move the patch out of its commit and into the index. This is achieved by starting an interactive rebase at the commit, applying the patch in reverse, continuing the rebase to completion, and then applying the patch to the index. If later commits depend on the patch, you may need to resolve conflicts.",
MovePatchIntoNewCommit: "Move patch into new commit",
MovePatchIntoNewCommitTooltip: "Move the patch out of its commit and into a new commit sitting on top of the original commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then applying the patch to the index and committing it as a new commit, before continuing the rebase to completion. If later commits depend on the patch, you may need to resolve conflicts.",
MovePatchToSelectedCommit: "Move patch to selected commit (%s)",
MovePatchToSelectedCommitTooltip: "Move the patch out of its original commit and into the selected commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then continuing the rebase up to the selected commit, before applying the patch forward and amending the seleced commit. The rebase is then continued to completion. If commits between the source and destination commit depend on the patch, you may need to resolve conflicts.",
CopyPatchToClipboard: "Copy patch to clipboard",
NoMatchesFor: "No matches for '%s' %s",
ExitSearchMode: "%s: Exit search mode",
Expand Down

0 comments on commit 82ce786

Please sign in to comment.