mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-17 00:18:05 +02:00
Mention ctrl+o binding in commit message sub title
Only do this when an onSwitchToEditor function is actually provided. For the "Move patch into new commit" command we don't, because it isn't totally straightforward in that case.
This commit is contained in:
@ -5,7 +5,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
|
"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"
|
||||||
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommitMessageContext struct {
|
type CommitMessageContext struct {
|
||||||
@ -108,6 +111,13 @@ func (self *CommitMessageContext) SetPanelState(
|
|||||||
self.viewModel.onSwitchToEditor = onSwitchToEditor
|
self.viewModel.onSwitchToEditor = onSwitchToEditor
|
||||||
self.GetView().Title = summaryTitle
|
self.GetView().Title = summaryTitle
|
||||||
self.c.Views().CommitDescription.Title = descriptionTitle
|
self.c.Views().CommitDescription.Title = descriptionTitle
|
||||||
|
|
||||||
|
subtitleTemplate := lo.Ternary(onSwitchToEditor != nil, self.c.Tr.CommitDescriptionSubTitle, self.c.Tr.CommitDescriptionSubTitleNoSwitch)
|
||||||
|
self.c.Views().CommitDescription.Subtitle = utils.ResolvePlaceholderString(subtitleTemplate,
|
||||||
|
map[string]string{
|
||||||
|
"togglePanelKeyBinding": keybindings.Label(self.c.UserConfig.Keybinding.Universal.TogglePanel),
|
||||||
|
"switchToEditorKeyBinding": keybindings.Label(self.c.UserConfig.Keybinding.CommitMessage.SwitchToEditor),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *CommitMessageContext) RenderCommitLength() {
|
func (self *CommitMessageContext) RenderCommitLength() {
|
||||||
|
@ -2,9 +2,7 @@ package gui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/jesseduffield/gocui"
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/theme"
|
"github.com/jesseduffield/lazygit/pkg/theme"
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -164,10 +162,6 @@ func (gui *Gui) createAllViews() error {
|
|||||||
|
|
||||||
gui.Views.CommitDescription.Visible = false
|
gui.Views.CommitDescription.Visible = false
|
||||||
gui.Views.CommitDescription.Title = gui.c.Tr.CommitDescriptionTitle
|
gui.Views.CommitDescription.Title = gui.c.Tr.CommitDescriptionTitle
|
||||||
gui.Views.CommitDescription.Subtitle = utils.ResolvePlaceholderString(gui.Tr.CommitDescriptionSubTitle,
|
|
||||||
map[string]string{
|
|
||||||
"togglePanelKeyBinding": keybindings.Label(gui.UserConfig.Keybinding.Universal.TogglePanel),
|
|
||||||
})
|
|
||||||
gui.Views.CommitDescription.FgColor = theme.GocuiDefaultTextColor
|
gui.Views.CommitDescription.FgColor = theme.GocuiDefaultTextColor
|
||||||
gui.Views.CommitDescription.Editable = true
|
gui.Views.CommitDescription.Editable = true
|
||||||
gui.Views.CommitDescription.Editor = gocui.EditorFunc(gui.commitDescriptionEditor)
|
gui.Views.CommitDescription.Editor = gocui.EditorFunc(gui.commitDescriptionEditor)
|
||||||
|
@ -199,6 +199,7 @@ type TranslationSet struct {
|
|||||||
CommitSummaryTitle string
|
CommitSummaryTitle string
|
||||||
CommitDescriptionTitle string
|
CommitDescriptionTitle string
|
||||||
CommitDescriptionSubTitle string
|
CommitDescriptionSubTitle string
|
||||||
|
CommitDescriptionSubTitleNoSwitch string
|
||||||
LocalBranchesTitle string
|
LocalBranchesTitle string
|
||||||
SearchTitle string
|
SearchTitle string
|
||||||
TagsTitle string
|
TagsTitle string
|
||||||
@ -969,7 +970,8 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
RebaseOptionsTitle: "Rebase options",
|
RebaseOptionsTitle: "Rebase options",
|
||||||
CommitSummaryTitle: "Commit summary",
|
CommitSummaryTitle: "Commit summary",
|
||||||
CommitDescriptionTitle: "Commit description",
|
CommitDescriptionTitle: "Commit description",
|
||||||
CommitDescriptionSubTitle: "Press {{.togglePanelKeyBinding}} to toggle focus",
|
CommitDescriptionSubTitle: "Press {{.togglePanelKeyBinding}} to toggle focus, {{.switchToEditorKeyBinding}} to switch to editor",
|
||||||
|
CommitDescriptionSubTitleNoSwitch: "Press {{.togglePanelKeyBinding}} to toggle focus",
|
||||||
LocalBranchesTitle: "Local branches",
|
LocalBranchesTitle: "Local branches",
|
||||||
SearchTitle: "Search",
|
SearchTitle: "Search",
|
||||||
TagsTitle: "Tags",
|
TagsTitle: "Tags",
|
||||||
|
Reference in New Issue
Block a user