Skip to content

Commit

Permalink
envelope: use message from current tab
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Robin Jarry <[email protected]>
  • Loading branch information
konimarti authored and rjarry committed Jan 19, 2024
1 parent 635f1fb commit d281737
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions commands/msg/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d281737

Please sign in to comment.