about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msgviewer.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index c179070..d5bbace 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -284,6 +284,10 @@ func (mv *MessageViewer) NextPart() {
 	mv.Invalidate()
 }
 
+func (mv *MessageViewer) Close() {
+	mv.switcher.Cleanup()
+}
+
 func (ps *PartSwitcher) Invalidate() {
 	ps.DoInvalidate(ps)
 }
@@ -381,6 +385,12 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
 	}
 }
 
+func (ps *PartSwitcher) Cleanup() {
+	for _, partViewer := range ps.parts {
+		partViewer.Cleanup()
+	}
+}
+
 func (mv *MessageViewer) Event(event tcell.Event) bool {
 	return mv.switcher.Event(event)
 }
@@ -593,6 +603,13 @@ func (pv *PartViewer) Draw(ctx *ui.Context) {
 	pv.term.Draw(ctx)
 }
 
+func (pv *PartViewer) Cleanup() {
+	if pv.pager != nil && pv.pager.Process != nil {
+		pv.pager.Process.Kill()
+		pv.pager = nil
+	}
+}
+
 type HeaderView struct {
 	ui.Invalidatable
 	Name  string