mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Show delete/edit keybindings in suggestions subtitle if available
This commit is contained in:
parent
a7041cf492
commit
010b0ae923
4 changed files with 18 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
)
|
)
|
||||||
|
@ -39,6 +41,14 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [
|
||||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||||
Handler: func() error {
|
Handler: func() error {
|
||||||
if len(self.c.Contexts().Suggestions.State.Suggestions) > 0 {
|
if len(self.c.Contexts().Suggestions.State.Suggestions) > 0 {
|
||||||
|
subtitle := ""
|
||||||
|
if self.c.State().GetRepoState().GetCurrentPopupOpts().HandleDeleteSuggestion != nil {
|
||||||
|
// We assume that whenever things are deletable, they
|
||||||
|
// are also editable, so we show both keybindings
|
||||||
|
subtitle = fmt.Sprintf(self.c.Tr.SuggestionsSubtitle,
|
||||||
|
self.c.UserConfig.Keybinding.Universal.Remove, self.c.UserConfig.Keybinding.Universal.Edit)
|
||||||
|
}
|
||||||
|
self.c.Views().Suggestions.Subtitle = subtitle
|
||||||
return self.c.ReplaceContext(self.c.Contexts().Suggestions)
|
return self.c.ReplaceContext(self.c.Contexts().Suggestions)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -159,6 +159,7 @@ func (self *ConfirmationHelper) prepareConfirmationPanel(
|
||||||
suggestionsContext.SetSuggestions(opts.FindSuggestionsFunc(""))
|
suggestionsContext.SetSuggestions(opts.FindSuggestionsFunc(""))
|
||||||
suggestionsView.Visible = true
|
suggestionsView.Visible = true
|
||||||
suggestionsView.Title = fmt.Sprintf(self.c.Tr.SuggestionsTitle, self.c.UserConfig.Keybinding.Universal.TogglePanel)
|
suggestionsView.Title = fmt.Sprintf(self.c.Tr.SuggestionsTitle, self.c.UserConfig.Keybinding.Universal.TogglePanel)
|
||||||
|
suggestionsView.Subtitle = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
self.ResizeConfirmationPanel()
|
self.ResizeConfirmationPanel()
|
||||||
|
|
|
@ -40,8 +40,11 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
|
||||||
Handler: func() error { return self.context().State.OnClose() },
|
Handler: func() error { return self.context().State.OnClose() },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||||
Handler: func() error { return self.c.ReplaceContext(self.c.Contexts().Confirmation) },
|
Handler: func() error {
|
||||||
|
self.c.Views().Suggestions.Subtitle = ""
|
||||||
|
return self.c.ReplaceContext(self.c.Contexts().Confirmation)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: opts.GetKey(opts.Config.Universal.Remove),
|
Key: opts.GetKey(opts.Config.Universal.Remove),
|
||||||
|
|
|
@ -631,6 +631,7 @@ type TranslationSet struct {
|
||||||
SuggestionsCheatsheetTitle string
|
SuggestionsCheatsheetTitle string
|
||||||
// Unlike the cheatsheet title above, the real suggestions title has a little message saying press tab to focus
|
// Unlike the cheatsheet title above, the real suggestions title has a little message saying press tab to focus
|
||||||
SuggestionsTitle string
|
SuggestionsTitle string
|
||||||
|
SuggestionsSubtitle string
|
||||||
ExtrasTitle string
|
ExtrasTitle string
|
||||||
PushingTagStatus string
|
PushingTagStatus string
|
||||||
PullRequestURLCopiedToClipboard string
|
PullRequestURLCopiedToClipboard string
|
||||||
|
@ -1593,6 +1594,7 @@ func EnglishTranslationSet() TranslationSet {
|
||||||
NavigationTitle: "List panel navigation",
|
NavigationTitle: "List panel navigation",
|
||||||
SuggestionsCheatsheetTitle: "Suggestions",
|
SuggestionsCheatsheetTitle: "Suggestions",
|
||||||
SuggestionsTitle: "Suggestions (press %s to focus)",
|
SuggestionsTitle: "Suggestions (press %s to focus)",
|
||||||
|
SuggestionsSubtitle: "(press %s to delete, %s to edit)",
|
||||||
ExtrasTitle: "Command log",
|
ExtrasTitle: "Command log",
|
||||||
PushingTagStatus: "Pushing tag",
|
PushingTagStatus: "Pushing tag",
|
||||||
PullRequestURLCopiedToClipboard: "Pull request URL copied to clipboard",
|
PullRequestURLCopiedToClipboard: "Pull request URL copied to clipboard",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue