diff options
author | Moritz Poldrack <git@moritz.sh> | 2023-05-26 10:22:47 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-06-01 22:19:19 +0200 |
commit | 5f5514d8742c803e5c0b701e3d6c053624687f70 (patch) | |
tree | 06ae86f50cb4f571c964de1b7b2695ca7192a97e /widgets/compose.go | |
parent | 11ccc471bb91e19334fa266f9837f9bb09a1e34d (diff) | |
download | aerc-5f5514d8742c803e5c0b701e3d6c053624687f70.tar.gz |
compose: quit composing when editor returns error
When the editor crashes, or the user forces it to exit with an error
code, it is safe to assume that they can't (if the command failed) or
don't want to (if :cq'd) continue composing a meaningful message.
Suggested-by: tristan957
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/compose.go')
-rw-r--r-- | widgets/compose.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/widgets/compose.go b/widgets/compose.go index ea6a50a4..43657a29 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -1022,6 +1022,12 @@ func (c *Composer) termClosed(err error) { if c.editor == nil { return } + if c.editor.cmd.ProcessState.ExitCode() > 0 { + c.Close() + c.aerc.RemoveTab(c, true) + c.aerc.PushError("Editor exited with error. Compose aborted!") + return + } c.grid.RemoveChild(c.editor) c.review = newReviewMessage(c, err) c.grid.AddChild(c.review).At(3, 0) |