diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/compose.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/widgets/compose.go b/widgets/compose.go index fa88b0f0..281a35cc 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -1144,12 +1144,26 @@ func (c *Composer) termEvent(event tcell.Event) bool { return false } +func (c *Composer) reopenEmailFile() error { + name := c.email.Name() + f, err := os.OpenFile(name, os.O_RDWR, 0o600) + if err != nil { + return err + } + err = c.email.Close() + c.email = f + return err +} + func (c *Composer) termClosed(err error) { c.Lock() defer c.Unlock() if c.editor == nil { return } + if e := c.reopenEmailFile(); e != nil { + c.aerc.PushError("Failed to reopen email file: " + e.Error()) + } editor := c.editor defer editor.Destroy() c.editor = nil |