aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-14 16:18:21 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-14 16:18:59 -0400
commit2c486cb7f52ac5dd88f7445ca79726639e4a0084 (patch)
tree552b1fe370f1fd2344687c7e55ada9d80c0bc9a7 /widgets
parent065da5e37230976d85d163a6f682eddb9345aede (diff)
Update tab name as subject changes
Also moves truncation to the tab widget
Diffstat (limited to 'widgets')
-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