Make tab width of :pipe consistent

This commit is contained in:
Drew DeVault 2019-03-31 15:13:47 -04:00
parent 958328427a
commit 1a4cc31d67
1 changed files with 3 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import (
"git.sr.ht/~sircmpwn/aerc2/widgets" "git.sr.ht/~sircmpwn/aerc2/widgets"
"github.com/gdamore/tcell" "github.com/gdamore/tcell"
"github.com/mattn/go-runewidth"
) )
func init() { func init() {
@ -36,11 +37,8 @@ func Pipe(aerc *widgets.Aerc, args []string) error {
Color(tcell.ColorDefault, tcell.ColorRed) Color(tcell.ColorDefault, tcell.ColorRed)
return return
} }
name := msg.Envelope.Subject name := args[1] + " <" + msg.Envelope.Subject
if len(name) > 12 { aerc.NewTab(term, runewidth.Truncate(name, 32, "…"))
name = name[:12]
}
aerc.NewTab(term, args[1] + " <" + name)
term.OnClose = func(err error) { term.OnClose = func(err error) {
if err != nil { if err != nil {
aerc.PushStatus(" "+err.Error(), 10*time.Second). aerc.PushStatus(" "+err.Error(), 10*time.Second).