From b0b3287bbdadad47757f3543a6560494af9175a8 Mon Sep 17 00:00:00 2001
From: Cole Helbling <cole.e.helbling@gmail.com>
Date: Tue, 14 May 2019 13:20:57 -0700
Subject: Implement abort command

This allows the user to close the compose tab without sending their
current composition.
---
 commands/compose/abort.go | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 commands/compose/abort.go

(limited to 'commands/compose')

diff --git a/commands/compose/abort.go b/commands/compose/abort.go
new file mode 100644
index 0000000..1cd297e
--- /dev/null
+++ b/commands/compose/abort.go
@@ -0,0 +1,23 @@
+package compose
+
+import (
+	"errors"
+
+	"git.sr.ht/~sircmpwn/aerc2/widgets"
+)
+
+func init() {
+	register("abort", CommandAbort)
+}
+
+func CommandAbort(aerc *widgets.Aerc, args []string) error {
+	if len(args) != 1 {
+		return errors.New("Usage: abort")
+	}
+	composer, _ := aerc.SelectedTab().(*widgets.Composer)
+
+	aerc.RemoveTab(composer)
+	composer.Close()
+
+	return nil
+}
-- 
cgit 1.4.1-2-gfad0