Preserve commit message when quitting while the commit message panel is open

This isn't possible with the default quit binding ('q'), but there's an
alternative binding (ctrl-c) that does work while the panel is open; also, users
can rebind quit to something like ctrl-q.
This commit is contained in:
Stefan Haller 2026-04-19 22:26:37 +02:00
parent afbfbb27a4
commit 337ab2a276
2 changed files with 12 additions and 0 deletions

View file

@ -91,6 +91,12 @@ func (self *CommitDescriptionController) GetOnFocus() func(types.OnFocusOpts) {
}
}
func (self *CommitDescriptionController) GetOnQuit() func() {
return func() {
self.c.Helpers().Commits.PreserveCommitMessage()
}
}
func (self *CommitDescriptionController) switchToCommitMessage() error {
self.c.Context().Replace(self.c.Contexts().CommitMessage)
return nil

View file

@ -82,6 +82,12 @@ func (self *CommitMessageController) GetOnFocusLost() func(types.OnFocusLostOpts
}
}
func (self *CommitMessageController) GetOnQuit() func() {
return func() {
self.c.Helpers().Commits.PreserveCommitMessage()
}
}
func (self *CommitMessageController) Context() types.Context {
return self.context()
}