From da62f63aad914521d97a565453f3e2f262161666 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 7 Jun 2019 16:22:04 -0400 Subject: Truncate long subject lines --- widgets/msglist.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'widgets') diff --git a/widgets/msglist.go b/widgets/msglist.go index f1cbb31..89aa52f 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -1,9 +1,11 @@ package widgets import ( + "fmt" "log" "github.com/gdamore/tcell" + "github.com/mattn/go-runewidth" "git.sr.ht/~sircmpwn/aerc/config" "git.sr.ht/~sircmpwn/aerc/lib" @@ -84,7 +86,9 @@ func (ml *MessageList) Draw(ctx *ui.Context) { if err != nil { ctx.Printf(0, row, style, "%v", err) } else { - ctx.Printf(0, row, style, fmtStr, args...) + line := fmt.Sprintf(fmtStr, args...) + line = runewidth.Truncate(line, ctx.Width(), "…") + ctx.Printf(0, row, style, "%s", line) } row += 1 -- cgit v1.2.3