From f2c2e80a5ce529e17d756d3c6e3b44fe60a29cfd Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 14:32:44 +0200 Subject: [PATCH 01/11] Show "Exit back to side panel" in options status bar for focused main view It's maybe not totally obvious, so let's show it. Esc now appears twice in the status bar, because the global controller also appends its generic "Cancel". We'll fix this in the next commit. --- pkg/gui/controllers/main_view_controller.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/gui/controllers/main_view_controller.go b/pkg/gui/controllers/main_view_controller.go index 5dfdb3233ac..fa7e6438a2e 100644 --- a/pkg/gui/controllers/main_view_controller.go +++ b/pkg/gui/controllers/main_view_controller.go @@ -39,9 +39,10 @@ func (self *MainViewController) GetKeybindings(opts types.KeybindingsOpts) []*ty DisplayOnScreen: true, }, { - Key: opts.GetKey(opts.Config.Universal.Return), - Handler: self.escape, - Description: self.c.Tr.ExitFocusedMainView, + Key: opts.GetKey(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 From 4961c4b678f82d5a8e2509aaabd9a3b43db00b24 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 14:11:43 +0200 Subject: [PATCH 02/11] Avoid duplicate key bindings in options map Sometimes there is a local and a global keybinding for the same key; if both are configured to be shown in the options map, we should only show the local one because it takes precedence. This happens for example for in a popup, or for in the focused main view. Note that this is also a problem in the keybindings menu, and we don't solve that here. --- pkg/gui/options_map.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/gui/options_map.go b/pkg/gui/options_map.go index bacc3b1069b..45521546883 100644 --- a/pkg/gui/options_map.go +++ b/pkg/gui/options_map.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/jesseduffield/generics/set" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers" "github.com/jesseduffield/lazygit/pkg/gui/keybindings" @@ -38,7 +39,14 @@ func (self *OptionsMapMgr) renderContextOptionsMap() { currentContextBindings := currentContext.GetKeybindings(self.c.KeybindingsOpts()) globalBindings := self.c.Contexts().Global.GetKeybindings(self.c.KeybindingsOpts()) - allBindings := append(currentContextBindings, globalBindings...) + currentContextKeys := set.NewFromSlice( + lo.Map(currentContextBindings, func(binding *types.Binding, _ int) types.Key { + return binding.Key + })) + + allBindings := append(currentContextBindings, lo.Filter(globalBindings, func(b *types.Binding, _ int) bool { + return !currentContextKeys.Includes(b.Key) + })...) bindingsToDisplay := lo.Filter(allBindings, func(binding *types.Binding, _ int) bool { return binding.DisplayOnScreen && !binding.IsDisabled() From 0af439ddf5b43cce197ee9da8ed3361c9483c5f3 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 18:08:27 +0200 Subject: [PATCH 03/11] Cleanup: remove dead code Cancelling searching (as opposed to filtering) is handled by gocui. --- pkg/gui/controllers/quit_actions.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/gui/controllers/quit_actions.go b/pkg/gui/controllers/quit_actions.go index 2775a92a679..381828c1fab 100644 --- a/pkg/gui/controllers/quit_actions.go +++ b/pkg/gui/controllers/quit_actions.go @@ -58,17 +58,12 @@ func (self *QuitActions) Escape() error { } } - switch ctx := currentContext.(type) { - case types.IFilterableContext: + // Cancelling searching (as opposed to filtering) is handled by gocui + if ctx, ok := currentContext.(types.IFilterableContext); ok { if ctx.IsFiltering() { self.c.Helpers().Search.Cancel() return nil } - case types.ISearchableContext: - if ctx.IsSearching() { - self.c.Helpers().Search.Cancel() - return nil - } } parentContext := currentContext.GetParentContext() From 7bf05dfca47e175d92bb24a256f1a0e036800be5 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 14:54:49 +0200 Subject: [PATCH 04/11] Avoid showing in options map when it doesn't do anything The code duplication between Escape and EscapeEnabled is unfortunate, but I don't see a better way to solve this. --- pkg/gui/controllers/global_controller.go | 21 +++++++--- pkg/gui/controllers/quit_actions.go | 40 +++++++++++++++++++ ...inding_suggestions_when_switching_repos.go | 4 +- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/pkg/gui/controllers/global_controller.go b/pkg/gui/controllers/global_controller.go index 9dfbeb4546f..bf99231822e 100644 --- a/pkg/gui/controllers/global_controller.go +++ b/pkg/gui/controllers/global_controller.go @@ -115,11 +115,12 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type Handler: self.quitWithoutChangingDirectory, }, { - Key: opts.GetKey(opts.Config.Universal.Return), - Modifier: gocui.ModNone, - Handler: self.escape, - Description: self.c.Tr.Cancel, - DisplayOnScreen: true, + Key: opts.GetKey(opts.Config.Universal.Return), + Modifier: gocui.ModNone, + Handler: self.escape, + Description: self.c.Tr.Cancel, + GetDisabledReason: self.escapeEnabled, + DisplayOnScreen: true, }, { Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView), @@ -190,6 +191,16 @@ func (self *GlobalController) escape() error { return (&QuitActions{c: self.c}).Escape() } +func (self *GlobalController) escapeEnabled() *types.DisabledReason { + if (&QuitActions{c: self.c}).EscapeEnabled() { + return nil + } + + // The empty error text is intentional. We don't want to show an error + // toast for this, but only hide it from the options map. + return &types.DisabledReason{Text: ""} +} + func (self *GlobalController) toggleWhitespace() error { return (&ToggleWhitespaceAction{c: self.c}).Call() } diff --git a/pkg/gui/controllers/quit_actions.go b/pkg/gui/controllers/quit_actions.go index 381828c1fab..f9b047357e4 100644 --- a/pkg/gui/controllers/quit_actions.go +++ b/pkg/gui/controllers/quit_actions.go @@ -48,6 +48,8 @@ func (self *QuitActions) confirmQuitDuringUpdate() error { } func (self *QuitActions) Escape() error { + // If you make changes to this function, be sure to update EscapeEnabled accordingly. + currentContext := self.c.Context().Current() if listContext, ok := currentContext.(types.IListContext); ok { @@ -90,3 +92,41 @@ func (self *QuitActions) Escape() error { return nil } + +func (self *QuitActions) EscapeEnabled() bool { + currentContext := self.c.Context().Current() + + if listContext, ok := currentContext.(types.IListContext); ok { + if listContext.GetList().IsSelectingRange() { + return true + } + } + + if ctx, ok := currentContext.(types.IFilterableContext); ok { + if ctx.IsFiltering() { + return true + } + } + + parentContext := currentContext.GetParentContext() + if parentContext != nil { + return true + } + + for _, mode := range self.c.Helpers().Mode.Statuses() { + if mode.IsActive() { + return true + } + } + + repoPathStack := self.c.State().GetRepoPathStack() + if !repoPathStack.IsEmpty() { + return true + } + + if self.c.UserConfig().QuitOnTopLevelReturn { + return true + } + + return false +} diff --git a/pkg/integration/tests/ui/keybinding_suggestions_when_switching_repos.go b/pkg/integration/tests/ui/keybinding_suggestions_when_switching_repos.go index d9c24aeb7fd..def9a53c742 100644 --- a/pkg/integration/tests/ui/keybinding_suggestions_when_switching_repos.go +++ b/pkg/integration/tests/ui/keybinding_suggestions_when_switching_repos.go @@ -31,12 +31,12 @@ var KeybindingSuggestionsWhenSwitchingRepos = NewIntegrationTest(NewIntegrationT t.Views().Files().Focus() t.Views().Options().Content( - Equals("Commit: c | Stash: s | Reset: D | Keybindings: ? | Cancel: ")) + Equals("Commit: c | Stash: s | Reset: D | Keybindings: ?")) switchToRepo("other") switchToRepo("repo") t.Views().Options().Content( - Equals("Commit: c | Stash: s | Reset: D | Keybindings: ? | Cancel: ")) + Equals("Commit: c | Stash: s | Reset: D | Keybindings: ?")) }, }) From d8ea83704f89433fb1ad1bb0a65bfb01af0c87c2 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 17:12:02 +0200 Subject: [PATCH 05/11] Rename ModeStatus.Description to InfoLabel It is styled and includes a "(Reset)" button, so it's really not a general-purpose description, but very specific to the Information view. --- pkg/gui/controllers/helpers/mode_helper.go | 20 ++++++++++---------- pkg/gui/information_panel.go | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/gui/controllers/helpers/mode_helper.go b/pkg/gui/controllers/helpers/mode_helper.go index 702825c5889..5bef7d43ad8 100644 --- a/pkg/gui/controllers/helpers/mode_helper.go +++ b/pkg/gui/controllers/helpers/mode_helper.go @@ -39,16 +39,16 @@ func NewModeHelper( } type ModeStatus struct { - IsActive func() bool - Description func() string - Reset func() error + IsActive func() bool + InfoLabel func() string + Reset func() error } func (self *ModeHelper) Statuses() []ModeStatus { return []ModeStatus{ { IsActive: self.c.Modes().Diffing.Active, - Description: func() string { + InfoLabel: func() string { return self.withResetButton( fmt.Sprintf( "%s %s", @@ -62,14 +62,14 @@ func (self *ModeHelper) Statuses() []ModeStatus { }, { IsActive: self.c.Git().Patch.PatchBuilder.Active, - Description: func() string { + InfoLabel: func() string { return self.withResetButton(self.c.Tr.BuildingPatch, style.FgYellow.SetBold()) }, Reset: self.patchBuildingHelper.Reset, }, { IsActive: self.c.Modes().Filtering.Active, - Description: func() string { + InfoLabel: func() string { filterContent := lo.Ternary(self.c.Modes().Filtering.GetPath() != "", self.c.Modes().Filtering.GetPath(), self.c.Modes().Filtering.GetAuthor()) return self.withResetButton( fmt.Sprintf( @@ -84,7 +84,7 @@ func (self *ModeHelper) Statuses() []ModeStatus { }, { IsActive: self.c.Modes().MarkedBaseCommit.Active, - Description: func() string { + InfoLabel: func() string { return self.withResetButton( self.c.Tr.MarkedBaseCommitStatus, style.FgCyan, @@ -94,7 +94,7 @@ func (self *ModeHelper) Statuses() []ModeStatus { }, { IsActive: self.c.Modes().CherryPicking.Active, - Description: func() string { + InfoLabel: func() string { copiedCount := len(self.c.Modes().CherryPicking.CherryPickedCommits) text := self.c.Tr.CommitsCopied if copiedCount == 1 { @@ -116,7 +116,7 @@ func (self *ModeHelper) Statuses() []ModeStatus { IsActive: func() bool { return !self.suppressRebasingMode && self.c.Git().Status.WorkingTreeState().Any() }, - Description: func() string { + InfoLabel: func() string { workingTreeState := self.c.Git().Status.WorkingTreeState() return self.withResetButton( workingTreeState.Title(self.c.Tr), style.FgYellow, @@ -128,7 +128,7 @@ func (self *ModeHelper) Statuses() []ModeStatus { IsActive: func() bool { return self.c.Model().BisectInfo.Started() }, - Description: func() string { + InfoLabel: func() string { return self.withResetButton(self.c.Tr.Bisect.Bisecting, style.FgGreen) }, Reset: self.bisectHelper.Reset, diff --git a/pkg/gui/information_panel.go b/pkg/gui/information_panel.go index ab2f3512d25..76001ecea06 100644 --- a/pkg/gui/information_panel.go +++ b/pkg/gui/information_panel.go @@ -10,7 +10,7 @@ import ( func (gui *Gui) informationStr() string { if activeMode, ok := gui.helpers.Mode.GetActiveMode(); ok { - return activeMode.Description() + return activeMode.InfoLabel() } if gui.g.Mouse { From a8e44dcea6d9bb092592b7b4f880cb96f18fe45f Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 17:10:34 +0200 Subject: [PATCH 06/11] Show context-specific labels for the global binding WHen several modes are active at the same time, it isn't totally obvious which one will be cancelled first, so show this in the status bar. --- pkg/gui/controllers/global_controller.go | 5 +++ pkg/gui/controllers/helpers/mode_helper.go | 28 +++++++++++++-- pkg/gui/controllers/quit_actions.go | 40 +++++++++++++++++++++- pkg/i18n/english.go | 12 +++++++ 4 files changed, 81 insertions(+), 4 deletions(-) diff --git a/pkg/gui/controllers/global_controller.go b/pkg/gui/controllers/global_controller.go index bf99231822e..f1bd7faefde 100644 --- a/pkg/gui/controllers/global_controller.go +++ b/pkg/gui/controllers/global_controller.go @@ -119,6 +119,7 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type Modifier: gocui.ModNone, Handler: self.escape, Description: self.c.Tr.Cancel, + DescriptionFunc: self.escapeDescription, GetDisabledReason: self.escapeEnabled, DisplayOnScreen: true, }, @@ -191,6 +192,10 @@ func (self *GlobalController) escape() error { return (&QuitActions{c: self.c}).Escape() } +func (self *GlobalController) escapeDescription() string { + return (&QuitActions{c: self.c}).EscapeDescription() +} + func (self *GlobalController) escapeEnabled() *types.DisabledReason { if (&QuitActions{c: self.c}).EscapeEnabled() { return nil diff --git a/pkg/gui/controllers/helpers/mode_helper.go b/pkg/gui/controllers/helpers/mode_helper.go index 5bef7d43ad8..e44d7b01bcd 100644 --- a/pkg/gui/controllers/helpers/mode_helper.go +++ b/pkg/gui/controllers/helpers/mode_helper.go @@ -39,9 +39,10 @@ func NewModeHelper( } type ModeStatus struct { - IsActive func() bool - InfoLabel func() string - Reset func() error + IsActive func() bool + InfoLabel func() string + CancelLabel func() string + Reset func() error } func (self *ModeHelper) Statuses() []ModeStatus { @@ -58,6 +59,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { style.FgMagenta, ) }, + CancelLabel: func() string { + return self.c.Tr.CancelDiffingMode + }, Reset: self.diffHelper.ExitDiffMode, }, { @@ -65,6 +69,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { InfoLabel: func() string { return self.withResetButton(self.c.Tr.BuildingPatch, style.FgYellow.SetBold()) }, + CancelLabel: func() string { + return self.c.Tr.ExitCustomPatchBuilder + }, Reset: self.patchBuildingHelper.Reset, }, { @@ -80,6 +87,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { style.FgRed, ) }, + CancelLabel: func() string { + return self.c.Tr.ExitFilterMode + }, Reset: self.ExitFilterMode, }, { @@ -90,6 +100,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { style.FgCyan, ) }, + CancelLabel: func() string { + return self.c.Tr.CancelMarkedBaseCommit + }, Reset: self.mergeAndRebaseHelper.ResetMarkedBaseCommit, }, { @@ -110,6 +123,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { style.FgCyan, ) }, + CancelLabel: func() string { + return self.c.Tr.ResetCherryPickShort + }, Reset: self.cherryPickHelper.Reset, }, { @@ -122,6 +138,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { workingTreeState.Title(self.c.Tr), style.FgYellow, ) }, + CancelLabel: func() string { + return fmt.Sprintf(self.c.Tr.AbortTitle, self.c.Git().Status.WorkingTreeState().CommandName()) + }, Reset: self.mergeAndRebaseHelper.AbortMergeOrRebaseWithConfirm, }, { @@ -131,6 +150,9 @@ func (self *ModeHelper) Statuses() []ModeStatus { InfoLabel: func() string { return self.withResetButton(self.c.Tr.Bisect.Bisecting, style.FgGreen) }, + CancelLabel: func() string { + return self.c.Tr.Actions.ResetBisect + }, Reset: self.bisectHelper.Reset, }, } diff --git a/pkg/gui/controllers/quit_actions.go b/pkg/gui/controllers/quit_actions.go index f9b047357e4..4713a6e23b6 100644 --- a/pkg/gui/controllers/quit_actions.go +++ b/pkg/gui/controllers/quit_actions.go @@ -48,7 +48,7 @@ func (self *QuitActions) confirmQuitDuringUpdate() error { } func (self *QuitActions) Escape() error { - // If you make changes to this function, be sure to update EscapeEnabled accordingly. + // If you make changes to this function, be sure to update EscapeEnabled and EscapeDescription accordingly. currentContext := self.c.Context().Current() @@ -130,3 +130,41 @@ func (self *QuitActions) EscapeEnabled() bool { return false } + +func (self *QuitActions) EscapeDescription() string { + currentContext := self.c.Context().Current() + + if listContext, ok := currentContext.(types.IListContext); ok { + if listContext.GetList().IsSelectingRange() { + return self.c.Tr.DismissRangeSelect + } + } + + if ctx, ok := currentContext.(types.IFilterableContext); ok { + if ctx.IsFiltering() { + return self.c.Tr.ExitFilterMode + } + } + + parentContext := currentContext.GetParentContext() + if parentContext != nil { + return self.c.Tr.ExitSubview + } + + for _, mode := range self.c.Helpers().Mode.Statuses() { + if mode.IsActive() { + return mode.CancelLabel() + } + } + + repoPathStack := self.c.State().GetRepoPathStack() + if !repoPathStack.IsEmpty() { + return self.c.Tr.BackToParentRepo + } + + if self.c.UserConfig().QuitOnTopLevelReturn { + return self.c.Tr.Quit + } + + return self.c.Tr.Cancel +} diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 39227d25d07..faedeb6e54c 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -601,6 +601,7 @@ type TranslationSet struct { RenameBranchWarning string OpenKeybindingsMenu string ResetCherryPick string + ResetCherryPickShort string NextTab string PrevTab string CantUndoWhileRebasing string @@ -634,6 +635,7 @@ type TranslationSet struct { SwapDiff string ViewDiffingOptions string ViewDiffingOptionsTooltip string + CancelDiffingMode string OpenCommandLogMenu string OpenCommandLogMenuTooltip string ShowingGitDiff string @@ -671,6 +673,7 @@ type TranslationSet struct { SubmoduleStashAndReset string AndResetSubmodules string EnterSubmoduleTooltip string + BackToParentRepo string Enter string CopySubmoduleNameToClipboard string RemoveSubmodule string @@ -699,6 +702,7 @@ type TranslationSet struct { BulkSubmoduleOptions string RunningCommand string SubCommitsTitle string + ExitSubview string SubmodulesTitle string NavigationTitle string SuggestionsCheatsheetTitle string @@ -861,6 +865,7 @@ type TranslationSet struct { MarkedBaseCommitStatus string MarkAsBaseCommit string MarkAsBaseCommitTooltip string + CancelMarkedBaseCommit string MarkedCommitMarker string FailedToOpenURL string InvalidLazygitEditURL string @@ -870,6 +875,7 @@ type TranslationSet struct { QuickStartInteractiveRebaseTooltip string CannotQuickStartInteractiveRebase string ToggleRangeSelect string + DismissRangeSelect string RangeSelectUp string RangeSelectDown string RangeSelectNotSupported string @@ -1349,6 +1355,7 @@ func EnglishTranslationSet() *TranslationSet { DiscardSelection: `Discard`, DiscardSelectionTooltip: "When unstaged change is selected, discard the change using `git reset`. When staged change is selected, unstage the change.", ToggleRangeSelect: "Toggle range select", + DismissRangeSelect: "Dismiss range select", ToggleSelectHunk: "Toggle hunk selection", SelectHunk: "Select hunks", SelectLineByLine: "Select line-by-line", @@ -1667,6 +1674,7 @@ func EnglishTranslationSet() *TranslationSet { RenameBranchWarning: "This branch is tracking a remote. This action will only rename the local branch name, not the name of the remote branch. Continue?", OpenKeybindingsMenu: "Open keybindings menu", ResetCherryPick: "Reset copied (cherry-picked) commits selection", + ResetCherryPickShort: "Reset copied commits", NextTab: "Next tab", PrevTab: "Previous tab", CantUndoWhileRebasing: "Can't undo while rebasing", @@ -1700,6 +1708,7 @@ func EnglishTranslationSet() *TranslationSet { SwapDiff: "Reverse diff direction", ViewDiffingOptions: "View diffing options", ViewDiffingOptionsTooltip: "View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction.", + CancelDiffingMode: "Cancel diffing mode", // the actual view is the extras view which I intend to give more tabs in future but for now we'll only mention the command log part OpenCommandLogMenu: "View command log options", OpenCommandLogMenuTooltip: "View options for the command log e.g. show/hide the command log and focus the command log.", @@ -1739,6 +1748,7 @@ func EnglishTranslationSet() *TranslationSet { AndResetSubmodules: "And reset submodules", Enter: "Enter", EnterSubmoduleTooltip: "Enter submodule. After entering the submodule, you can press `{{.escape}}` to escape back to the parent repo.", + BackToParentRepo: "Back to parent repo", CopySubmoduleNameToClipboard: "Copy submodule name to clipboard", RemoveSubmodule: "Remove submodule", RemoveSubmodulePrompt: "Are you sure you want to remove submodule '%s' and its corresponding directory? This is irreversible.", @@ -1766,6 +1776,7 @@ func EnglishTranslationSet() *TranslationSet { BulkSubmoduleOptions: "Bulk submodule options", RunningCommand: "Running command", SubCommitsTitle: "Sub-commits", + ExitSubview: "Exit subview", SubmodulesTitle: "Submodules", NavigationTitle: "List panel navigation", SuggestionsCheatsheetTitle: "Suggestions", @@ -1925,6 +1936,7 @@ func EnglishTranslationSet() *TranslationSet { MarkedBaseCommitStatus: "Marked a base commit for rebase", MarkAsBaseCommit: "Mark as base commit for rebase", MarkAsBaseCommitTooltip: "Select a base commit for the next rebase. When you rebase onto a branch, only commits above the base commit will be brought across. This uses the `git rebase --onto` command.", + CancelMarkedBaseCommit: "Cancel marked base commit", MarkedCommitMarker: "↑↑↑ Will rebase from here ↑↑↑", FailedToOpenURL: "Failed to open URL %s\n\nError: %v", InvalidLazygitEditURL: "Invalid lazygit-edit URL format: %s", From 5f91b1b48e639122d354b737195ee0d327159427 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 18:31:40 +0200 Subject: [PATCH 07/11] Move global escape handler to before the keybindings menu handler The main reason for this is that sometimes the escape key is handled by a local binding, in which case it appears before the '?' binding in the options status bar, and other times it is handled by the global controller, in which case it appeared after. Moving it to before the keybindings menu handler makes it appear before '?' in both cases. Also, if the window is too narrow to show all keybindings, the ones that don't fit will be truncated, and in this case it is more important to show the esc binding because of its context sensitivity. This also moves the esc entry up a few positions in the keybindings menu, but I don't think this matters much. --- docs/keybindings/Keybindings_en.md | 2 +- docs/keybindings/Keybindings_ja.md | 2 +- docs/keybindings/Keybindings_ko.md | 2 +- docs/keybindings/Keybindings_nl.md | 2 +- docs/keybindings/Keybindings_pl.md | 2 +- docs/keybindings/Keybindings_pt.md | 2 +- docs/keybindings/Keybindings_ru.md | 2 +- docs/keybindings/Keybindings_zh-CN.md | 2 +- docs/keybindings/Keybindings_zh-TW.md | 2 +- pkg/gui/controllers/global_controller.go | 18 +++++++++--------- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index ab1a8684268..c095dd5e7ac 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -24,12 +24,12 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. | | `` + `` | Next screen mode (normal/half/fullscreen) | | | `` _ `` | Prev screen mode | | +| `` `` | Cancel | | | `` ? `` | Open keybindings menu | | | `` `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. | | `` W `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` q `` | Quit | | -| `` `` | Cancel | | | `` `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | Undo | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | | `` `` | Redo | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | diff --git a/docs/keybindings/Keybindings_ja.md b/docs/keybindings/Keybindings_ja.md index ec536b302f3..dd358c41741 100644 --- a/docs/keybindings/Keybindings_ja.md +++ b/docs/keybindings/Keybindings_ja.md @@ -24,12 +24,12 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味 | `` R `` | 更新 | Gitの状態を更新します(`git status`、`git branch`などをバックグラウンドで実行してパネルの内容を更新します)。これは`git fetch`を実行しません。 | | `` + `` | 次の画面モード(通常/半分/全画面) | | | `` _ `` | 前の画面モード | | +| `` `` | キャンセル | | | `` ? `` | キーバインディングメニューを開く | | | `` `` | フィルターオプションを表示 | コミットログのフィルタリングオプションを表示し、フィルタに一致するコミットのみを表示します。 | | `` W `` | 差分オプションを表示 | 2つのrefの差分に関連するオプションを表示します(例:選択したrefとの差分表示、差分を取るrefの入力、差分方向の反転など)。 | | `` `` | 差分オプションを表示 | 2つのrefの差分に関連するオプションを表示します(例:選択したrefとの差分表示、差分を取るrefの入力、差分方向の反転など)。 | | `` q `` | 終了 | | -| `` `` | キャンセル | | | `` `` | 空白表示の切り替え | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | 元に戻す | 最後のgitコマンドを元に戻すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 | | `` `` | やり直す | 最後のgitコマンドをやり直すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 | diff --git a/docs/keybindings/Keybindings_ko.md b/docs/keybindings/Keybindings_ko.md index de2c6c71964..0ae0b17a076 100644 --- a/docs/keybindings/Keybindings_ko.md +++ b/docs/keybindings/Keybindings_ko.md @@ -24,12 +24,12 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` R `` | 새로고침 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. | | `` + `` | 다음 스크린 모드 (normal/half/fullscreen) | | | `` _ `` | 이전 스크린 모드 | | +| `` `` | 취소 | | | `` ? `` | 매뉴 열기 | | | `` `` | View filter-by-path options | View options for filtering the commit log, so that only commits matching the filter are shown. | | `` W `` | Diff 메뉴 열기 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` `` | Diff 메뉴 열기 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` q `` | 종료 | | -| `` `` | 취소 | | | `` `` | 공백문자를 Diff 뷰에서 표시 여부 전환 | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | 되돌리기 (reflog) (실험적) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | | `` `` | 다시 실행 (reflog) (실험적) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index cda93faee6d..658e69772aa 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -24,12 +24,12 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` R `` | Verversen | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. | | `` + `` | Volgende scherm modus (normaal/half/groot) | | | `` _ `` | Vorige scherm modus | | +| `` `` | Annuleren | | | `` ? `` | Open menu | | | `` `` | Bekijk scoping opties | View options for filtering the commit log, so that only commits matching the filter are shown. | | `` W `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` q `` | Quit | | -| `` `` | Annuleren | | | `` `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | Ongedaan maken (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | | `` `` | Redo (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. | diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index 311194a0f76..c9134eec0b2 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -24,12 +24,12 @@ _Legenda: `` oznacza ctrl+b, `` oznacza alt+b, `B` oznacza shift+b_ | `` R `` | Odśwież | Odśwież stan git (tj. uruchom `git status`, `git branch`, itp. w tle, aby zaktualizować zawartość paneli). To nie uruchamia `git fetch`. | | `` + `` | Następny tryb ekranu (normalny/półpełny/pełnoekranowy) | | | `` _ `` | Poprzedni tryb ekranu | | +| `` `` | Anuluj | | | `` ? `` | Otwórz menu przypisań klawiszy | | | `` `` | Pokaż opcje filtrowania | Pokaż opcje filtrowania dziennika commitów, tak aby pokazywane były tylko commity pasujące do filtra. | | `` W `` | Pokaż opcje różnicowania | Pokaż opcje dotyczące różnicowania dwóch refów, np. różnicowanie względem wybranego refa, wprowadzanie refa do różnicowania i odwracanie kierunku różnic. | | `` `` | Pokaż opcje różnicowania | Pokaż opcje dotyczące różnicowania dwóch refów, np. różnicowanie względem wybranego refa, wprowadzanie refa do różnicowania i odwracanie kierunku różnic. | | `` q `` | Wyjdź | | -| `` `` | Anuluj | | | `` `` | Przełącz białe znaki | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | Cofnij | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby cofnąć ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. | | `` `` | Ponów | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby ponowić ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. | diff --git a/docs/keybindings/Keybindings_pt.md b/docs/keybindings/Keybindings_pt.md index 096be874dc1..b1a86a48205 100644 --- a/docs/keybindings/Keybindings_pt.md +++ b/docs/keybindings/Keybindings_pt.md @@ -24,12 +24,12 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | `` R `` | Atualizar | Atualize o estado do git (ou seja, execute `git status`, `git branch`, etc em segundo plano para atualizar o conteúdo de painéis). Isso não executa `git fetch`. | | `` + `` | Next screen mode (normal/half/fullscreen) | | | `` _ `` | Prev screen mode | | +| `` `` | Cancelar | | | `` ? `` | Open keybindings menu | | | `` `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. | | `` W `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` q `` | Sair | | -| `` `` | Cancelar | | | `` `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | Desfazer | O reflog será usado para determinar qual comando git para executar para desfazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração. | | `` `` | Refazer | O reflog será usado para determinar qual comando git para executar para refazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração. | diff --git a/docs/keybindings/Keybindings_ru.md b/docs/keybindings/Keybindings_ru.md index 48af4b35f76..90bc925c716 100644 --- a/docs/keybindings/Keybindings_ru.md +++ b/docs/keybindings/Keybindings_ru.md @@ -24,12 +24,12 @@ _Связки клавиш_ | `` R `` | Обновить | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. | | `` + `` | Следующий режим экрана (нормальный/полуэкранный/полноэкранный) | | | `` _ `` | Предыдущий режим экрана | | +| `` `` | Отменить | | | `` ? `` | Открыть меню | | | `` `` | Просмотреть параметры фильтрации по пути | View options for filtering the commit log, so that only commits matching the filter are shown. | | `` W `` | Открыть меню сравнении | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` `` | Открыть меню сравнении | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` q `` | Выйти | | -| `` `` | Отменить | | | `` `` | Переключить отображение изменении пробелов в просмотрщике сравнении | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | Отменить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git запустить, чтобы отменить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. | | `` `` | Повторить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git нужно запустить, чтобы повторить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. | diff --git a/docs/keybindings/Keybindings_zh-CN.md b/docs/keybindings/Keybindings_zh-CN.md index c85be039b2f..26f7cc4a243 100644 --- a/docs/keybindings/Keybindings_zh-CN.md +++ b/docs/keybindings/Keybindings_zh-CN.md @@ -24,12 +24,12 @@ _图例:`` 意味着ctrl+b, `意味着Alt+b, `B` 意味着shift+b_ | `` R `` | 刷新 | 刷新git状态(即在后台上运行`git status`,`git branch`等命令以更新面板内容) 不会运行`git fetch` | | `` + `` | 下一屏模式(正常/半屏/全屏) | | | `` _ `` | 上一屏模式 | | +| `` `` | 取消 | | | `` ? `` | 打开菜单 | | | `` `` | 查看按路径过滤选项 | 查看用于过滤提交日志的选项,以便仅显示与过滤器匹配的提交。 | | `` W `` | 打开 diff 菜单 | 查看与比较两个引用相关的选项,例如与选定的 ref 进行比较,输入要比较的 ref,然后反转比较方向。 | | `` `` | 打开 diff 菜单 | 查看与比较两个引用相关的选项,例如与选定的 ref 进行比较,输入要比较的 ref,然后反转比较方向。 | | `` q `` | 退出 | | -| `` `` | 取消 | | | `` `` | 切换是否在差异视图中显示空白字符差异 | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | 撤销 | Reflog将用于确定运行哪个git命令来撤消最后一个git命令。这并不包括对工作树的更改,只考虑提交。 | | `` `` | 重做 | Reflog将用于确定运行哪个git命令来重做上一个git命令。这并不包括对工作树的更改,只考虑提交。 | diff --git a/docs/keybindings/Keybindings_zh-TW.md b/docs/keybindings/Keybindings_zh-TW.md index 5f980089ba6..f25a18acc03 100644 --- a/docs/keybindings/Keybindings_zh-TW.md +++ b/docs/keybindings/Keybindings_zh-TW.md @@ -24,12 +24,12 @@ _說明:`` 表示 Ctrl+B、`` 表示 Alt+B,`B`表示 Shift+B | `` R `` | 重新整理 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. | | `` + `` | 下一個螢幕模式(常規/半螢幕/全螢幕) | | | `` _ `` | 上一個螢幕模式 | | +| `` `` | 取消 | | | `` ? `` | 開啟選單 | | | `` `` | 檢視篩選路徑選項 | View options for filtering the commit log, so that only commits matching the filter are shown. | | `` W `` | 開啟差異比較選單 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` `` | 開啟差異比較選單 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. | | `` q `` | 結束 | | -| `` `` | 取消 | | | `` `` | 切換是否在差異檢視中顯示空格變更 | Toggle whether or not whitespace changes are shown in the diff view.

The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. | | `` z `` | 復原 | 將使用 reflog 確任 git 指令以復原。這不包括工作區更改;只考慮提交。 | | `` `` | 取消復原 | 將使用 reflog 確任 git 指令以重作。這不包括工作區更改;只考慮提交。 | diff --git a/pkg/gui/controllers/global_controller.go b/pkg/gui/controllers/global_controller.go index f1bd7faefde..fcf281cf4d1 100644 --- a/pkg/gui/controllers/global_controller.go +++ b/pkg/gui/controllers/global_controller.go @@ -58,6 +58,15 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type Handler: opts.Guards.NoPopupPanel(self.prevScreenMode), Description: self.c.Tr.PrevScreenMode, }, + { + Key: opts.GetKey(opts.Config.Universal.Return), + Modifier: gocui.ModNone, + Handler: self.escape, + Description: self.c.Tr.Cancel, + DescriptionFunc: self.escapeDescription, + GetDisabledReason: self.escapeEnabled, + DisplayOnScreen: true, + }, { ViewName: "", Key: opts.GetKey(opts.Config.Universal.OptionMenu), @@ -114,15 +123,6 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type Modifier: gocui.ModNone, Handler: self.quitWithoutChangingDirectory, }, - { - Key: opts.GetKey(opts.Config.Universal.Return), - Modifier: gocui.ModNone, - Handler: self.escape, - Description: self.c.Tr.Cancel, - DescriptionFunc: self.escapeDescription, - GetDisabledReason: self.escapeEnabled, - DisplayOnScreen: true, - }, { Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView), Handler: self.toggleWhitespace, From 51066b14b117d84502199df1fe60736d2816d23c Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 17:27:58 +0200 Subject: [PATCH 08/11] Show escape binding for staging and patch building in the status bar --- pkg/gui/controllers/patch_building_controller.go | 7 ++++--- pkg/gui/controllers/staging_controller.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/gui/controllers/patch_building_controller.go b/pkg/gui/controllers/patch_building_controller.go index 166cc4a2b31..1f181f2102f 100644 --- a/pkg/gui/controllers/patch_building_controller.go +++ b/pkg/gui/controllers/patch_building_controller.go @@ -43,9 +43,10 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts) DisplayOnScreen: true, }, { - Key: opts.GetKey(opts.Config.Universal.Return), - Handler: self.Escape, - Description: self.c.Tr.ExitCustomPatchBuilder, + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.Escape, + Description: self.c.Tr.ExitCustomPatchBuilder, + DisplayOnScreen: true, }, } } diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go index 51c6fafec0e..4e9a9cb8670 100644 --- a/pkg/gui/controllers/staging_controller.go +++ b/pkg/gui/controllers/staging_controller.go @@ -68,9 +68,10 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ Tooltip: self.c.Tr.EditFileTooltip, }, { - Key: opts.GetKey(opts.Config.Universal.Return), - Handler: self.Escape, - Description: self.c.Tr.ReturnToFilesPanel, + Key: opts.GetKey(opts.Config.Universal.Return), + Handler: self.Escape, + Description: self.c.Tr.ReturnToFilesPanel, + DisplayOnScreen: true, }, { Key: opts.GetKey(opts.Config.Universal.TogglePanel), From aeff98645047d555c6754ae6fb023772bb3b2e4a Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 18:38:50 +0200 Subject: [PATCH 09/11] Show context-specific labels for in staging and patch building view Dismissing a range selection is handled by the global escape handler for all list views, but not for the staging and patch building views, so we need to make the esc description dynamic for these, too. --- pkg/gui/controllers/patch_building_controller.go | 16 ++++++++++++++++ pkg/gui/controllers/staging_controller.go | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/pkg/gui/controllers/patch_building_controller.go b/pkg/gui/controllers/patch_building_controller.go index 1f181f2102f..c4f8390f6e8 100644 --- a/pkg/gui/controllers/patch_building_controller.go +++ b/pkg/gui/controllers/patch_building_controller.go @@ -46,6 +46,7 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts) Key: opts.GetKey(opts.Config.Universal.Return), Handler: self.Escape, Description: self.c.Tr.ExitCustomPatchBuilder, + DescriptionFunc: self.EscapeDescription, DisplayOnScreen: true, }, } @@ -180,3 +181,18 @@ func (self *PatchBuildingController) Escape() error { self.c.Helpers().PatchBuilding.Escape() return nil } + +func (self *PatchBuildingController) EscapeDescription() string { + context := self.c.Contexts().CustomPatchBuilder + if state := context.GetState(); state != nil { + if state.SelectingRange() { + return self.c.Tr.DismissRangeSelect + } + + if state.SelectingHunkEnabledByUser() { + return self.c.Tr.SelectLineByLine + } + } + + return self.c.Tr.ExitCustomPatchBuilder +} diff --git a/pkg/gui/controllers/staging_controller.go b/pkg/gui/controllers/staging_controller.go index 4e9a9cb8670..f667dd212c3 100644 --- a/pkg/gui/controllers/staging_controller.go +++ b/pkg/gui/controllers/staging_controller.go @@ -71,6 +71,7 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ Key: opts.GetKey(opts.Config.Universal.Return), Handler: self.Escape, Description: self.c.Tr.ReturnToFilesPanel, + DescriptionFunc: self.EscapeDescription, DisplayOnScreen: true, }, { @@ -179,6 +180,20 @@ func (self *StagingController) Escape() error { return nil } +func (self *StagingController) EscapeDescription() string { + if state := self.context.GetState(); state != nil { + if state.SelectingRange() { + return self.c.Tr.DismissRangeSelect + } + + if state.SelectingHunkEnabledByUser() { + return self.c.Tr.SelectLineByLine + } + } + + return self.c.Tr.ReturnToFilesPanel +} + func (self *StagingController) TogglePanel() error { if self.otherContext.GetState() != nil { self.c.Context().Push(self.otherContext, types.OnFocusOpts{}) From 0c0c32aec4121ba707027ca41b97e09bce96f3df Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 12 Aug 2025 20:17:20 +0200 Subject: [PATCH 10/11] Show "Close/Cancel: " for menus like we do for confirmations For many menus, just "Close" is fine, but some menus act more like confirmations (e.g. the menu that appears when you cherry-pick and get conflicts); in this case, it's good to make it more obvious that hitting esc cancels the whole thing. --- docs/keybindings/Keybindings_en.md | 2 +- docs/keybindings/Keybindings_ja.md | 2 +- docs/keybindings/Keybindings_ko.md | 2 +- docs/keybindings/Keybindings_pl.md | 2 +- docs/keybindings/Keybindings_pt.md | 2 +- docs/keybindings/Keybindings_ru.md | 2 +- docs/keybindings/Keybindings_zh-TW.md | 2 +- pkg/gui/controllers/menu_controller.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index c095dd5e7ac..b73a505c3a8 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -256,7 +256,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | Key | Action | Info | |-----|--------|-------------| | `` `` | Execute | | -| `` `` | Close | | +| `` `` | Close/Cancel | | | `` / `` | Filter the current view by text | | ## Reflog diff --git a/docs/keybindings/Keybindings_ja.md b/docs/keybindings/Keybindings_ja.md index dd358c41741..9d8460d964c 100644 --- a/docs/keybindings/Keybindings_ja.md +++ b/docs/keybindings/Keybindings_ja.md @@ -302,7 +302,7 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味 | Key | Action | Info | |-----|--------|-------------| | `` `` | 実行 | | -| `` `` | 閉じる | | +| `` `` | 閉じる/キャンセル | | | `` / `` | 現在のビューをテキストでフィルタリング | | ## リフログ diff --git a/docs/keybindings/Keybindings_ko.md b/docs/keybindings/Keybindings_ko.md index 0ae0b17a076..1dd33ba5495 100644 --- a/docs/keybindings/Keybindings_ko.md +++ b/docs/keybindings/Keybindings_ko.md @@ -128,7 +128,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | Key | Action | Info | |-----|--------|-------------| | `` `` | 실행 | | -| `` `` | 닫기 | | +| `` `` | 닫기/취소 | | | `` / `` | Filter the current view by text | | ## 메인 패널 (Merging) diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index c9134eec0b2..f599d6cff9d 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -159,7 +159,7 @@ _Legenda: `` oznacza ctrl+b, `` oznacza alt+b, `B` oznacza shift+b_ | Key | Action | Info | |-----|--------|-------------| | `` `` | Wykonaj | | -| `` `` | Zamknij | | +| `` `` | Zamknij/Anuluj | | | `` / `` | Filtruj bieżący widok po tekście | | ## Panel główny (normalny) diff --git a/docs/keybindings/Keybindings_pt.md b/docs/keybindings/Keybindings_pt.md index b1a86a48205..66c92a90e6c 100644 --- a/docs/keybindings/Keybindings_pt.md +++ b/docs/keybindings/Keybindings_pt.md @@ -221,7 +221,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_ | Key | Action | Info | |-----|--------|-------------| | `` `` | Executar | | -| `` `` | Fechar | | +| `` `` | Fechar/Cancelar | | | `` / `` | Filter the current view by text | | ## Painel Principal (Normal) diff --git a/docs/keybindings/Keybindings_ru.md b/docs/keybindings/Keybindings_ru.md index 90bc925c716..efd8a34bf74 100644 --- a/docs/keybindings/Keybindings_ru.md +++ b/docs/keybindings/Keybindings_ru.md @@ -227,7 +227,7 @@ _Связки клавиш_ | Key | Action | Info | |-----|--------|-------------| | `` `` | Выполнить | | -| `` `` | Закрыть | | +| `` `` | Закрыть/отменить | | | `` / `` | Filter the current view by text | | ## Панель Подтверждения diff --git a/docs/keybindings/Keybindings_zh-TW.md b/docs/keybindings/Keybindings_zh-TW.md index f25a18acc03..a716e6cfdc1 100644 --- a/docs/keybindings/Keybindings_zh-TW.md +++ b/docs/keybindings/Keybindings_zh-TW.md @@ -119,7 +119,7 @@ _說明:`` 表示 Ctrl+B、`` 表示 Alt+B,`B`表示 Shift+B | Key | Action | Info | |-----|--------|-------------| | `` `` | 執行 | | -| `` `` | 關閉 | | +| `` `` | 關閉/取消 | | | `` / `` | 搜尋 | | ## 子提交 diff --git a/pkg/gui/controllers/menu_controller.go b/pkg/gui/controllers/menu_controller.go index 8baf9104ea3..25d919f542e 100644 --- a/pkg/gui/controllers/menu_controller.go +++ b/pkg/gui/controllers/menu_controller.go @@ -47,7 +47,7 @@ func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types. { Key: opts.GetKey(opts.Config.Universal.Return), Handler: self.close, - Description: self.c.Tr.Close, + Description: self.c.Tr.CloseCancel, DisplayOnScreen: true, }, } From da7121fa87d8c7f615f67b27e45ed0fc5ca04314 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 13 Aug 2025 08:45:50 +0200 Subject: [PATCH 11/11] Don't append "Disabled: " to menu tooltip if disabled reason is empty In some cases we set a disabled reason but leave the text empty, so that we don't get an error toast when the item is invoked. In such a case it looks awkward if there is a tooltip showing "Disabled: " with no following text. --- pkg/gui/controllers/helpers/confirmation_helper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index df059bef48e..c5927527553 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -348,7 +348,7 @@ func (self *ConfirmationHelper) IsPopupPanelFocused() bool { func (self *ConfirmationHelper) TooltipForMenuItem(menuItem *types.MenuItem) string { tooltip := menuItem.Tooltip - if menuItem.DisabledReason != nil { + if menuItem.DisabledReason != nil && menuItem.DisabledReason.Text != "" { if tooltip != "" { tooltip += "\n\n" }