mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-27 12:32:37 +02:00
Show the alt-enter keybinding at bottom of commit description view (#4136)
- **PR Description** It wasn't really obvious how to commit when the focus is in the commit description view, since pressing enter inserts a newline there. To improve this, show the `<a-enter>` keybinding at the bottom of the description view when it is focused. Fixes #4134.
This commit is contained in:
commit
ef718f3386
@ -3,7 +3,9 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommitDescriptionController struct {
|
type CommitDescriptionController struct {
|
||||||
@ -59,6 +61,15 @@ func (self *CommitDescriptionController) GetMouseKeybindings(opts types.Keybindi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *CommitDescriptionController) GetOnFocus() func(types.OnFocusOpts) {
|
||||||
|
return func(types.OnFocusOpts) {
|
||||||
|
self.c.Views().CommitDescription.Footer = utils.ResolvePlaceholderString(self.c.Tr.CommitDescriptionFooter,
|
||||||
|
map[string]string{
|
||||||
|
"confirmInEditorKeybinding": keybindings.Label(self.c.UserConfig().Keybinding.Universal.ConfirmInEditor),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (self *CommitDescriptionController) switchToCommitMessage() error {
|
func (self *CommitDescriptionController) switchToCommitMessage() error {
|
||||||
self.c.Context().Replace(self.c.Contexts().CommitMessage)
|
self.c.Context().Replace(self.c.Contexts().CommitMessage)
|
||||||
return nil
|
return nil
|
||||||
|
@ -69,6 +69,12 @@ func (self *CommitMessageController) GetMouseKeybindings(opts types.KeybindingsO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *CommitMessageController) GetOnFocus() func(types.OnFocusOpts) {
|
||||||
|
return func(types.OnFocusOpts) {
|
||||||
|
self.c.Views().CommitDescription.Footer = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (self *CommitMessageController) GetOnFocusLost() func(types.OnFocusLostOpts) {
|
func (self *CommitMessageController) GetOnFocusLost() func(types.OnFocusLostOpts) {
|
||||||
return func(types.OnFocusLostOpts) {
|
return func(types.OnFocusLostOpts) {
|
||||||
self.context().RenderCommitLength()
|
self.context().RenderCommitLength()
|
||||||
|
@ -290,6 +290,7 @@ type TranslationSet struct {
|
|||||||
CommitSummaryTitle string
|
CommitSummaryTitle string
|
||||||
CommitDescriptionTitle string
|
CommitDescriptionTitle string
|
||||||
CommitDescriptionSubTitle string
|
CommitDescriptionSubTitle string
|
||||||
|
CommitDescriptionFooter string
|
||||||
LocalBranchesTitle string
|
LocalBranchesTitle string
|
||||||
SearchTitle string
|
SearchTitle string
|
||||||
TagsTitle string
|
TagsTitle string
|
||||||
@ -1290,6 +1291,7 @@ func EnglishTranslationSet() *TranslationSet {
|
|||||||
CommitSummaryTitle: "Commit summary",
|
CommitSummaryTitle: "Commit summary",
|
||||||
CommitDescriptionTitle: "Commit description",
|
CommitDescriptionTitle: "Commit description",
|
||||||
CommitDescriptionSubTitle: "Press {{.togglePanelKeyBinding}} to toggle focus, {{.commitMenuKeybinding}} to open menu",
|
CommitDescriptionSubTitle: "Press {{.togglePanelKeyBinding}} to toggle focus, {{.commitMenuKeybinding}} to open menu",
|
||||||
|
CommitDescriptionFooter: "Press {{.confirmInEditorKeybinding}} to commit",
|
||||||
LocalBranchesTitle: "Local branches",
|
LocalBranchesTitle: "Local branches",
|
||||||
SearchTitle: "Search",
|
SearchTitle: "Search",
|
||||||
TagsTitle: "Tags",
|
TagsTitle: "Tags",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user