diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-17 17:39:22 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-17 17:39:49 -0400 |
commit | 60b17c473a0edbd806c9f0c8e4b3b238cb60227e (patch) | |
tree | 4a1c2f5b4547122f52118a79139d0a1a84a6d447 /commands | |
parent | dee0f8938b62d668ed9105c96313fbd8b8bbd098 (diff) | |
download | aerc-60b17c473a0edbd806c9f0c8e4b3b238cb60227e.tar.gz |
Wrap Terminal in TermHost
Diffstat (limited to 'commands')
-rw-r--r-- | commands/term-close.go | 12 | ||||
-rw-r--r-- | commands/term.go | 13 |
2 files changed, 6 insertions, 19 deletions
diff --git a/commands/term-close.go b/commands/term-close.go index 38fcc27f..30f3392f 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 } diff --git a/commands/term.go b/commands/term.go index 976ce293..1981e62b 100644 --- a/commands/term.go +++ b/commands/term.go @@ -4,7 +4,6 @@ import ( "os/exec" "time" - "git.sr.ht/~sircmpwn/aerc2/lib/ui" "git.sr.ht/~sircmpwn/aerc2/widgets" "github.com/gdamore/tcell" @@ -27,14 +26,8 @@ func Term(aerc *widgets.Aerc, args []string) error { if err != nil { return err } - grid := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_WEIGHT, 1}, - }).Columns([]ui.GridSpec{ - {ui.SIZE_EXACT, aerc.Config().Ui.SidebarWidth}, - {ui.SIZE_WEIGHT, 1}, - }) - grid.AddChild(term).At(0, 1) - tab := aerc.NewTab(grid, args[1]) + host := widgets.NewTermHost(term, aerc.Config()) + tab := aerc.NewTab(host, args[1]) term.OnTitle = func(title string) { if title == "" { title = args[1] @@ -43,7 +36,7 @@ func Term(aerc *widgets.Aerc, args []string) error { tab.Content.Invalidate() } term.OnClose = func(err error) { - aerc.RemoveTab(grid) + aerc.RemoveTab(host) if err != nil { aerc.PushStatus(" "+err.Error(), 10*time.Second). Color(tcell.ColorRed, tcell.ColorWhite) |