summary refs log tree commit diff stats
path: root/widgets/compose.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/compose.go')
-rw-r--r--widgets/compose.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 9460397..71b55e7 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -100,6 +100,12 @@ func NewComposer(conf *config.AercConfig,
 	return c
 }
 
+func (c *Composer) OnSubjectChange(fn func(subject string)) {
+	c.headers.subject.OnChange(func() {
+		fn(c.headers.subject.input.String())
+	})
+}
+
 func (c *Composer) Draw(ctx *ui.Context) {
 	c.grid.Draw(ctx)
 }
@@ -287,6 +293,12 @@ func (he *headerEditor) Event(event tcell.Event) bool {
 	return he.input.Event(event)
 }
 
+func (he *headerEditor) OnChange(fn func()) {
+	he.input.OnChange(func(_ *ui.TextInput) {
+		fn()
+	})
+}
+
 type reviewMessage struct {
 	composer *Composer
 	grid     *ui.Grid