diff options
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 094060032..ea897f085 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -386,18 +386,24 @@ func (gui *Gui) handleCommitPress() error { return gui.promptToStageAllAndRetry(gui.handleCommitPress) } - commitPrefixConfig := gui.commitPrefixConfigForRepo() - if commitPrefixConfig != nil { - prefixPattern := commitPrefixConfig.Pattern - prefixReplace := commitPrefixConfig.Replace - rgx, err := regexp.Compile(prefixPattern) - if err != nil { - return gui.createErrorPanel(fmt.Sprintf("%s: %s", gui.Tr.LcCommitPrefixPatternError, err.Error())) - } - prefix := rgx.ReplaceAllString(gui.getCheckedOutBranch().Name, prefixReplace) + if len(gui.State.messageFailedCommit) > 0 { gui.Views.CommitMessage.ClearTextArea() - gui.Views.CommitMessage.TextArea.TypeString(prefix) - gui.render() + gui.Views.CommitMessage.TextArea.TypeString(gui.State.messageFailedCommit) + gui.Views.CommitMessage.RenderTextArea() + } else { + commitPrefixConfig := gui.commitPrefixConfigForRepo() + if commitPrefixConfig != nil { + prefixPattern := commitPrefixConfig.Pattern + prefixReplace := commitPrefixConfig.Replace + rgx, err := regexp.Compile(prefixPattern) + if err != nil { + return gui.createErrorPanel(fmt.Sprintf("%s: %s", gui.Tr.LcCommitPrefixPatternError, err.Error())) + } + prefix := rgx.ReplaceAllString(gui.getCheckedOutBranch().Name, prefixReplace) + gui.Views.CommitMessage.ClearTextArea() + gui.Views.CommitMessage.TextArea.TypeString(prefix) + gui.Views.CommitMessage.RenderTextArea() + } } gui.g.Update(func(g *gocui.Gui) error { |