From 2c486cb7f52ac5dd88f7445ca79726639e4a0084 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 14 May 2019 16:18:21 -0400 Subject: Update tab name as subject changes Also moves truncation to the tab widget --- widgets/compose.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'widgets') diff --git a/widgets/compose.go b/widgets/compose.go index 9460397c..71b55e7c 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 -- cgit