aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--doc/aerc.1.scd3
-rw-r--r--widgets/compose.go6
3 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5eed2aef..c321b001 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `:archive` now works on servers using a different delimiter
+### Changed
+
+- Composing an email is now aborted if the text editor exits with an error
+ (e.g. with `vim`, abort an email with `:cq`).
+
## [0.15.2](https://git.sr.ht/~rjarry/aerc/refs/0.15.2) - 2023-05-11
### Fixed
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index cf6f7caa..0c89460b 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -522,6 +522,9 @@ message list, the message in the message viewer, etc).
*:abort*
Close the composer without sending, discarding the message in progress.
+ If the text editor exits with an error (e.g. *:cq* in *vim*(1)), the
+ message is immediately discarded.
+
*:attach* _<path>_++
*:attach* *-m* [_<arg>_]
Attaches the file at the given path to the email. The path can contain
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)