diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2022-03-21 18:23:47 -0500 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-03-22 09:50:32 +0100 |
commit | e56648029f2231a58ed4afbbe804b845e02fde62 (patch) | |
tree | a59f4fe6308de6d9e7241ac5e0a6cb8d909d70b3 /widgets/aerc.go | |
parent | 93c160ab66c0ecf6854dfc13ef3ebba26c3aefe8 (diff) | |
download | aerc-e56648029f2231a58ed4afbbe804b845e02fde62.zip |
compose: make headerEditor focusing more reliable
Focusing header editors was hardcoded as integers which only worked with
the default ui. If a user changed the UI to, for example, put CC as a
field below "to", FocusSubject would focus the CC field instead of the
subject. This commit reuses and modifies the function FocusEditor to
generalize the focusing of header editors - which can now be called by
name via FocusEditor(name string)
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r-- | widgets/aerc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go index a8b23fe..c96932c 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -575,14 +575,14 @@ func (aerc *Aerc) Mailto(addr *url.URL) error { return nil } composer.SetContents(strings.NewReader(body)) - composer.FocusSubject() + composer.FocusEditor("subject") title := "New email" if subject != "" { title = subject composer.FocusTerminal() } if to == nil { - composer.FocusRecipient() + composer.FocusEditor("to") } tab := aerc.NewTab(composer, title) composer.OnHeaderChange("Subject", func(subject string) { |