Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/gui/context/commit_message_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"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 {
Expand Down Expand Up @@ -112,8 +111,7 @@ func (self *CommitMessageContext) SetPanelState(
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,
self.c.Views().CommitDescription.Subtitle = utils.ResolvePlaceholderString(self.c.Tr.CommitDescriptionSubTitle,
map[string]string{
"togglePanelKeyBinding": keybindings.Label(self.c.UserConfig.Keybinding.Universal.TogglePanel),
"commitMenuKeybinding": keybindings.Label(self.c.UserConfig.Keybinding.CommitMessage.CommitMenu),
Expand Down
14 changes: 9 additions & 5 deletions pkg/gui/controllers/helpers/commits_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ func TryRemoveHardLineBreaks(message string, autoWrapWidth int) string {
}

func (self *CommitsHelper) SwitchToEditor() error {
if !self.c.Contexts().CommitMessage.CanSwitchToEditor() {
return nil
}

message := lo.Ternary(len(self.getCommitDescription()) == 0,
self.getCommitSummary(),
self.getCommitSummary()+"\n\n"+self.getCommitDescription())
Expand Down Expand Up @@ -218,13 +214,21 @@ func (self *CommitsHelper) commitMessageContexts() []types.Context {
}

func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.Suggestion) error {
var disabledReasonForOpenInEditor *types.DisabledReason
if !self.c.Contexts().CommitMessage.CanSwitchToEditor() {
disabledReasonForOpenInEditor = &types.DisabledReason{
Text: self.c.Tr.CommandDoesNotSupportOpeningInEditor,
}
}

menuItems := []*types.MenuItem{
{
Label: self.c.Tr.OpenInEditor,
OnPress: func() error {
return self.SwitchToEditor()
},
Key: 'e',
Key: 'e',
DisabledReason: disabledReasonForOpenInEditor,
},
{
Label: self.c.Tr.AddCoAuthor,
Expand Down
4 changes: 2 additions & 2 deletions pkg/i18n/english.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ type TranslationSet struct {
CommitSummaryTitle string
CommitDescriptionTitle string
CommitDescriptionSubTitle string
CommitDescriptionSubTitleNoSwitch string
LocalBranchesTitle string
SearchTitle string
TagsTitle string
Expand Down Expand Up @@ -776,6 +775,7 @@ type TranslationSet struct {
SelectedItemDoesNotHaveFiles string
RangeSelectNotSupportedForSubmodules string
OldCherryPickKeyWarning string
CommandDoesNotSupportOpeningInEditor string
Actions Actions
Bisect Bisect
Log Log
Expand Down Expand Up @@ -1229,7 +1229,6 @@ func EnglishTranslationSet() TranslationSet {
CommitSummaryTitle: "Commit summary",
CommitDescriptionTitle: "Commit description",
CommitDescriptionSubTitle: "Press {{.togglePanelKeyBinding}} to toggle focus, {{.commitMenuKeybinding}} to open menu",
CommitDescriptionSubTitleNoSwitch: "Press {{.togglePanelKeyBinding}} to toggle focus",
LocalBranchesTitle: "Local branches",
SearchTitle: "Search",
TagsTitle: "Tags",
Expand Down Expand Up @@ -1733,6 +1732,7 @@ func EnglishTranslationSet() TranslationSet {
SelectedItemDoesNotHaveFiles: "Selected item does not have files to view",
RangeSelectNotSupportedForSubmodules: "Range select not supported for submodules",
OldCherryPickKeyWarning: "The 'c' key is no longer the default key for copying commits to cherry pick. Please use `{{.copy}}` instead (and `{{.paste}}` to paste). The reason for this change is that the 'v' key for selecting a range of lines when staging is now also used for selecting a range of lines in any list view, meaning that we needed to find a new key for pasting commits, and if we're going to now use `{{.paste}}` for pasting commits, we may as well use `{{.copy}}` for copying them. If you want to configure the keybindings to get the old behaviour, set the following in your config:\n\nkeybinding:\n universal:\n toggleRangeSelect: <something other than v>\n commits:\n cherryPickCopy: 'c'\n pasteCommits: 'v'",
CommandDoesNotSupportOpeningInEditor: "This command doesn't support switching to the editor",

Actions: Actions{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
Expand Down
1 change: 0 additions & 1 deletion pkg/i18n/polish.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ func polishTranslationSet() TranslationSet {
CommitSummaryTitle: "Podsumowanie commita",
CommitDescriptionTitle: "Opis commita",
CommitDescriptionSubTitle: "Naciśnij {{.togglePanelKeyBinding}}, aby przełączyć fokus, {{.commitMenuKeybinding}}, aby otworzyć menu",
CommitDescriptionSubTitleNoSwitch: "Naciśnij {{.togglePanelKeyBinding}}, aby przełączyć fokus",
LocalBranchesTitle: "Lokalne gałęzie",
SearchTitle: "Szukaj",
TagsTitle: "Tagi",
Expand Down