1
0
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:
Stefan Haller
2023-05-18 19:20:42 +02:00
parent 61bd3e8dd2
commit 8f628296ad
3 changed files with 13 additions and 7 deletions

View File

@ -5,7 +5,10 @@ import (
"strings"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/samber/lo"
)
type CommitMessageContext struct {
@ -108,6 +111,13 @@ func (self *CommitMessageContext) SetPanelState(
self.viewModel.onSwitchToEditor = onSwitchToEditor
self.GetView().Title = summaryTitle
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() {