aerc/commands/msgview/close.go
Kevin Kuehler be4ea0d96b Cleanup pager processes after closing a msgviewer
A pager is spawned every time an email is viewed but not killed off when
quitting the msgviewer, thus leading to process leakage. This patch
fixes this by adding a Close method to the msgview widget, which is
called in the close command.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-10-16 11:13:53 -04:00

31 lines
503 B
Go

package msgview
import (
"errors"
"git.sr.ht/~sircmpwn/aerc/widgets"
)
type Close struct{}
func init() {
register(Close{})
}
func (Close) Aliases() []string {
return []string{"close"}
}
func (Close) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
}
func (Close) Execute(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: close")
}
mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
mv.Close()
aerc.RemoveTab(mv)
return nil
}