From d2817371867e94b621de4054b235d53312db8073 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Thu, 18 Jan 2024 11:38:26 +0100 Subject: envelope: use message from current tab Use the message from the current tab to populate the :envelope window. Fixes: https://todo.sr.ht/~rjarry/aerc/213 Signed-off-by: Koni Marti Acked-by: Robin Jarry --- commands/msg/envelope.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'commands/msg/envelope.go') diff --git a/commands/msg/envelope.go b/commands/msg/envelope.go index e104648d..62a266b0 100644 --- a/commands/msg/envelope.go +++ b/commands/msg/envelope.go @@ -26,13 +26,18 @@ func (Envelope) Aliases() []string { } func (e Envelope) Execute(args []string) error { - acct := app.SelectedAccount() + provider, ok := app.SelectedTabContent().(app.ProvidesMessages) + if !ok { + return fmt.Errorf("current tab does not implement app.ProvidesMessage interface") + } + + acct := provider.SelectedAccount() if acct == nil { return errors.New("No account selected") } var list []string - if msg, err := acct.SelectedMessage(); err != nil { + if msg, err := provider.SelectedMessage(); err != nil { return err } else { if msg != nil { -- cgit