From dee0f8938b62d668ed9105c96313fbd8b8bbd098 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 17 Mar 2019 17:23:53 -0400 Subject: Add :term-close --- lib/ui/tab.go | 4 ++-- lib/ui/text.go | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/ui') diff --git a/lib/ui/tab.go b/lib/ui/tab.go index e41e906a..32b195c3 100644 --- a/lib/ui/tab.go +++ b/lib/ui/tab.go @@ -62,13 +62,13 @@ func (tabs *Tabs) Remove(content Drawable) { } /* Force the selected index into the existing range */ if tabs.Selected >= len(tabs.Tabs) { - tabs.Select(len(tabs.Tabs) - 1) + tabs.Select(tabs.Selected - 1) } tabs.TabStrip.Invalidate() } func (tabs *Tabs) Select(index int) { - if tabs.Selected >= len(tabs.Tabs) { + if index >= len(tabs.Tabs) { panic("Tried to set tab index to a non-existing element") } diff --git a/lib/ui/text.go b/lib/ui/text.go index d3f6c6b5..b962166d 100644 --- a/lib/ui/text.go +++ b/lib/ui/text.go @@ -20,7 +20,11 @@ type Text struct { } func NewText(text string) *Text { - return &Text{text: text} + return &Text{ + bg: tcell.ColorDefault, + fg: tcell.ColorDefault, + text: text, + } } func (t *Text) Text(text string) *Text { -- cgit