about summary refs log tree commit diff stats
path: root/lib/ui/tab.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-14 16:18:21 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-14 16:18:59 -0400
commit2c486cb7f52ac5dd88f7445ca79726639e4a0084 (patch)
tree552b1fe370f1fd2344687c7e55ada9d80c0bc9a7 /lib/ui/tab.go
parent065da5e37230976d85d163a6f682eddb9345aede (diff)
downloadaerc-2c486cb7f52ac5dd88f7445ca79726639e4a0084.tar.gz
Update tab name as subject changes
Also moves truncation to the tab widget
Diffstat (limited to 'lib/ui/tab.go')
-rw-r--r--lib/ui/tab.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index 49bdffa..c39e327 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -2,6 +2,7 @@ package ui
 
 import (
 	"github.com/gdamore/tcell"
+	"github.com/mattn/go-runewidth"
 )
 
 type Tabs struct {
@@ -87,7 +88,8 @@ func (strip *TabStrip) Draw(ctx *Context) {
 		if strip.Selected == i {
 			style = tcell.StyleDefault
 		}
-		x += ctx.Printf(x, 0, style, " %s ", tab.Name)
+		trunc := runewidth.Truncate(tab.Name, 32, "…")
+		x += ctx.Printf(x, 0, style, " %s ", trunc)
 	}
 	style := tcell.StyleDefault.Reverse(true)
 	ctx.Fill(x, 0, ctx.Width()-x, 1, ' ', style)