From 2a0da301c51a8862c4e8a73b141adc0f416833a5 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Fri, 3 Feb 2023 13:23:08 -0600 Subject: tabs: use template for compose tabs Use a template for compose tabs. Other available values: Account string Subject string To []*mail.Address From []*mail.Address Cc []*mail.Address Bcc []*mail.Address OriginalFrom []*mail.Address When you use To, From, CC, BCC, or OriginalFrom the title will only be updated when an editing field has lost focus. This is so we don't end up calling "PrepareHeader" on every keystroke, which will likely error out anyways since it will be an invalid header. Subject still updates every keystroke. Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- commands/msg/unsubscribe.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'commands/msg/unsubscribe.go') diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index 37ed707f..46ff5d1f 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -9,7 +9,6 @@ import ( "time" "git.sr.ht/~rjarry/aerc/lib" - "git.sr.ht/~rjarry/aerc/lib/ui" "git.sr.ht/~rjarry/aerc/log" "git.sr.ht/~rjarry/aerc/widgets" "github.com/emersion/go-message/mail" @@ -160,15 +159,7 @@ func unsubscribeMailto(aerc *widgets.Aerc, u *url.URL) error { return err } composer.SetContents(strings.NewReader(u.Query().Get("body"))) - tab := aerc.NewTab(composer, "unsubscribe") - composer.OnHeaderChange("Subject", func(subject string) { - if subject == "" { - tab.Name = "unsubscribe" - } else { - tab.Name = subject - } - ui.Invalidate() - }) + composer.Tab = aerc.NewTab(composer, "unsubscribe") composer.FocusTerminal() return nil } -- cgit