Extract PreserveCommitMessage from CloseCommitMessagePanel

We'll want to call just the preservation step when the app is quitting
with the commit message panel open: at that point the view-hiding and
context-popping in CloseCommitMessagePanel are pointless (the app is
about to exit), and some of the focus-lost side effects could be
surprising during teardown.
This commit is contained in:
Stefan Haller 2026-04-19 21:15:12 +02:00
parent 5c61126c4b
commit 3de2a2d96c

View file

@ -173,13 +173,17 @@ func (self *CommitsHelper) HandleCommitConfirm() error {
return nil
}
func (self *CommitsHelper) CloseCommitMessagePanel() {
func (self *CommitsHelper) PreserveCommitMessage() {
if self.c.Contexts().CommitMessage.GetPreserveMessage() {
message := self.JoinCommitMessageAndUnwrappedDescription()
if message != self.c.Contexts().CommitMessage.GetInitialMessage() {
self.c.Contexts().CommitMessage.SetPreservedMessageAndLogError(message)
}
}
}
func (self *CommitsHelper) CloseCommitMessagePanel() {
self.PreserveCommitMessage()
self.c.Contexts().CommitMessage.SetHistoryMessage("")