summary refs log tree commit diff stats
path: root/commands/term-close.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-17 17:39:22 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-17 17:39:49 -0400
commit60b17c473a0edbd806c9f0c8e4b3b238cb60227e (patch)
tree4a1c2f5b4547122f52118a79139d0a1a84a6d447 /commands/term-close.go
parentdee0f8938b62d668ed9105c96313fbd8b8bbd098 (diff)
downloadaerc-60b17c473a0edbd806c9f0c8e4b3b238cb60227e.tar.gz
Wrap Terminal in TermHost
Diffstat (limited to 'commands/term-close.go')
-rw-r--r--commands/term-close.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/commands/term-close.go b/commands/term-close.go
index 38fcc27..30f3392 100644
--- a/commands/term-close.go
+++ b/commands/term-close.go
@@ -3,7 +3,6 @@ package commands
 import (
 	"errors"
 
-	"git.sr.ht/~sircmpwn/aerc2/lib/ui"
 	"git.sr.ht/~sircmpwn/aerc2/widgets"
 )
 
@@ -15,15 +14,10 @@ func TermClose(aerc *widgets.Aerc, args []string) error {
 	if len(args) != 1 {
 		return errors.New("Usage: term-close")
 	}
-	grid, ok := aerc.SelectedTab().(*ui.Grid)
+	thost, ok := aerc.SelectedTab().(*widgets.TermHost)
 	if !ok {
 		return errors.New("Error: not a terminal")
 	}
-	for _, child := range grid.Children() {
-		if term, ok := child.(*widgets.Terminal); ok {
-			term.Close(nil)
-			return nil
-		}
-	}
-	return errors.New("Error: not a terminal")
+	thost.Terminal().Close(nil)
+	return nil
 }