From 1f5293931adf591fcbeaa9a272d717240da9213a Mon Sep 17 00:00:00 2001 From: Jelle Besseling Date: Sun, 18 Aug 2019 11:33:15 +0200 Subject: Add forwarding as attachment feature This allows a single message to be forward as attachment with the :forward -a command --- widgets/compose.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'widgets/compose.go') 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() -- cgit v1.2.3