Skip to content

Commit 7394abc

Browse files
committed
WIP
1 parent bd1c084 commit 7394abc

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

docs/Config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ keybinding:
272272
bulkMenu: 'b'
273273
commitMessage:
274274
switchToEditor: '<c-o>'
275-
addCoAuthor: '<c-e>'
275+
commitMenu: '<c-e>'
276276
amendAttribute:
277277
addCoAuthor: 'c'
278278
resetAuthor: 'a'

pkg/config/user_config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ type KeybindingSubmodulesConfig struct {
441441

442442
type KeybindingCommitMessageConfig struct {
443443
SwitchToEditor string `yaml:"switchToEditor"`
444-
AddCoAuthor string `yaml:"addCoAuthor"`
444+
CommitMenu string `yaml:"commitMenu"`
445445
}
446446

447447
// OSConfig contains config on the level of the os
@@ -831,7 +831,7 @@ func GetDefaultConfig() *UserConfig {
831831
},
832832
CommitMessage: KeybindingCommitMessageConfig{
833833
SwitchToEditor: "<c-o>",
834-
AddCoAuthor: "<c-e>",
834+
CommitMenu: "<c-e>",
835835
},
836836
},
837837
OS: OSConfig{},

pkg/gui/context/commit_message_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (self *CommitMessageContext) SetPanelState(
117117
map[string]string{
118118
"togglePanelKeyBinding": keybindings.Label(self.c.UserConfig.Keybinding.Universal.TogglePanel),
119119
"switchToEditorKeyBinding": keybindings.Label(self.c.UserConfig.Keybinding.CommitMessage.SwitchToEditor),
120-
"addCoAuthorKeyBinding": keybindings.Label(self.c.UserConfig.Keybinding.CommitMessage.AddCoAuthor),
120+
"commitMenuKeybinding": keybindings.Label(self.c.UserConfig.Keybinding.CommitMessage.CommitMenu),
121121
})
122122
}
123123

pkg/gui/controllers/commit_description_controller.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func (self *CommitDescriptionController) GetKeybindings(opts types.KeybindingsOp
4040
Handler: self.switchToEditor,
4141
},
4242
{
43-
Key: opts.GetKey(opts.Config.CommitMessage.AddCoAuthor),
44-
Handler: self.addCoAuthor,
43+
Key: opts.GetKey(opts.Config.CommitMessage.CommitMenu),
44+
Handler: self.openCommitMenu,
4545
},
4646
}
4747

@@ -72,6 +72,22 @@ func (self *CommitDescriptionController) switchToEditor() error {
7272
return self.c.Helpers().Commits.SwitchToEditor()
7373
}
7474

75+
func (self *CommitDescriptionController) openCommitMenu() error {
76+
menuItems := []*types.MenuItem{
77+
{
78+
Label: self.c.Tr.AddCoAuthor,
79+
OnPress: func() error {
80+
return self.addCoAuthor()
81+
},
82+
Key: 'c',
83+
},
84+
}
85+
return self.c.Menu(types.CreateMenuOptions{
86+
Title: self.c.Tr.CommitMenuTitle,
87+
Items: menuItems,
88+
})
89+
}
90+
7591
func (self *CommitDescriptionController) addCoAuthor() error {
7692
return self.c.Prompt(types.PromptOpts{
7793
Title: self.c.Tr.AddCoAuthorPromptTitle,

pkg/gui/controllers/commit_message_controller.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func (self *CommitMessageController) GetKeybindings(opts types.KeybindingsOpts)
5151
Handler: self.switchToEditor,
5252
},
5353
{
54-
Key: opts.GetKey(opts.Config.CommitMessage.AddCoAuthor),
55-
Handler: self.addCoAuthor,
54+
Key: opts.GetKey(opts.Config.CommitMessage.CommitMenu),
55+
Handler: self.openCommitMenu,
5656
},
5757
}
5858

@@ -96,6 +96,22 @@ func (self *CommitMessageController) switchToEditor() error {
9696
return self.c.Helpers().Commits.SwitchToEditor()
9797
}
9898

99+
func (self *CommitMessageController) openCommitMenu() error {
100+
menuItems := []*types.MenuItem{
101+
{
102+
Label: self.c.Tr.AddCoAuthor,
103+
OnPress: func() error {
104+
return self.addCoAuthor()
105+
},
106+
Key: 'c',
107+
},
108+
}
109+
return self.c.Menu(types.CreateMenuOptions{
110+
Title: self.c.Tr.CommitMenuTitle,
111+
Items: menuItems,
112+
})
113+
}
114+
99115
func (self *CommitMessageController) addCoAuthor() error {
100116
return self.c.Prompt(types.PromptOpts{
101117
Title: self.c.Tr.AddCoAuthorPromptTitle,

pkg/i18n/english.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ type TranslationSet struct {
208208
SearchTitle string
209209
TagsTitle string
210210
MenuTitle string
211+
CommitMenuTitle string
211212
RemotesTitle string
212213
RemoteBranchesTitle string
213214
PatchBuildingTitle string
@@ -1000,12 +1001,13 @@ func EnglishTranslationSet() TranslationSet {
10001001
RebaseOptionsTitle: "Rebase options",
10011002
CommitSummaryTitle: "Commit summary",
10021003
CommitDescriptionTitle: "Commit description",
1003-
CommitDescriptionSubTitle: "{{.togglePanelKeyBinding}} Toggle focus, {{.switchToEditorKeyBinding}} Open editor, {{.addCoAuthorKeyBinding}} Add author",
1004+
CommitDescriptionSubTitle: "{{.togglePanelKeyBinding}} Toggle focus, {{.switchToEditorKeyBinding}} Open editor, {{.commitMenuKeybinding}} Menu",
10041005
CommitDescriptionSubTitleNoSwitch: "Press {{.togglePanelKeyBinding}} to toggle focus",
10051006
LocalBranchesTitle: "Local branches",
10061007
SearchTitle: "Search",
10071008
TagsTitle: "Tags",
10081009
MenuTitle: "Menu",
1010+
CommitMenuTitle: "Commit Menu",
10091011
RemotesTitle: "Remotes",
10101012
RemoteBranchesTitle: "Remote branches",
10111013
PatchBuildingTitle: "Main panel (patch building)",

0 commit comments

Comments
 (0)