aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorJelle Besseling <jelle@pingiun.com>2019-08-18 11:33:15 +0200
committerDrew DeVault <sir@cmpwn.com>2019-08-20 10:05:51 +0900
commit1f5293931adf591fcbeaa9a272d717240da9213a (patch)
tree4b14e64f11fd283341607842ea8acd3ca4ccaf94 /widgets
parent36c6030e81b229414bb42bf7fc37d091c6497ddf (diff)
Add forwarding as attachment feature
This allows a single message to be forward as attachment with the :forward -a command
Diffstat (limited to 'widgets')
-rw-r--r--widgets/compose.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index b4ae078..a49a947 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -42,6 +42,8 @@ type Composer struct {
layout HeaderLayout
focusable []ui.DrawableInteractive
focused int
+
+ onClose []func(ti *Composer)
}
func NewComposer(conf *config.AercConfig,
@@ -169,6 +171,10 @@ func (c *Composer) OnHeaderChange(header string, fn func(subject string)) {
}
}
+func (c *Composer) OnClose(fn func(composer *Composer)) {
+ c.onClose = append(c.onClose, fn)
+}
+
func (c *Composer) Draw(ctx *ui.Context) {
c.grid.Draw(ctx)
}
@@ -184,6 +190,9 @@ func (c *Composer) OnInvalidate(fn func(d ui.Drawable)) {
}
func (c *Composer) Close() {
+ for _, onClose := range c.onClose {
+ onClose(c)
+ }
if c.email != nil {
path := c.email.Name()
c.email.Close()