diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-05-14 16:18:21 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-05-14 16:18:59 -0400 |
commit | 2c486cb7f52ac5dd88f7445ca79726639e4a0084 (patch) | |
tree | 552b1fe370f1fd2344687c7e55ada9d80c0bc9a7 /widgets | |
parent | 065da5e37230976d85d163a6f682eddb9345aede (diff) | |
download | aerc-2c486cb7f52ac5dd88f7445ca79726639e4a0084.tar.gz |
Update tab name as subject changes
Also moves truncation to the tab widget
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/compose.go | 12 |
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 |