summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
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 02a9d0c..14dfaaa 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -124,6 +124,15 @@ func (c *Composer) Defaults(defaults map[string]string) *Composer {
 	return c
 }
 
+// Note: this does not reload the editor. You must call this before the first
+// Draw() call.
+func (c *Composer) SetContents(reader io.Reader) *Composer {
+	c.email.Seek(0, os.SEEK_SET)
+	io.Copy(c.email, reader)
+	c.email.Seek(0, os.SEEK_SET)
+	return c
+}
+
 func (c *Composer) FocusTerminal() *Composer {
 	c.focusable[c.focused].Focus(false)
 	c.focused = 3