summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-31 15:13:47 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-31 15:13:47 -0400
commit1a4cc31d67cf7679966d6cf2928b7ad3e152c061 (patch)
tree9747bace22b39ca5cf84a955d13e0d9606b66fdf
parent958328427ab8cbbb064e11f2e7f2f68d3563a6cb (diff)
downloadaerc-1a4cc31d67cf7679966d6cf2928b7ad3e152c061.tar.gz
Make tab width of :pipe consistent
-rw-r--r--commands/account/pipe.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/commands/account/pipe.go b/commands/account/pipe.go
index bff1596..a4c9848 100644
--- a/commands/account/pipe.go
+++ b/commands/account/pipe.go
@@ -9,6 +9,7 @@ import (
 	"git.sr.ht/~sircmpwn/aerc2/widgets"
 
 	"github.com/gdamore/tcell"
+	"github.com/mattn/go-runewidth"
 )
 
 func init() {
@@ -36,11 +37,8 @@ func Pipe(aerc *widgets.Aerc, args []string) error {
 				Color(tcell.ColorDefault, tcell.ColorRed)
 			return
 		}
-		name := msg.Envelope.Subject
-		if len(name) > 12 {
-			name = name[:12]
-		}
-		aerc.NewTab(term, args[1] + " <" + name)
+		name := args[1] + " <" + msg.Envelope.Subject
+		aerc.NewTab(term, runewidth.Truncate(name, 32, "…"))
 		term.OnClose = func(err error) {
 			if err != nil {
 				aerc.PushStatus(" "+err.Error(), 10*time.Second).