about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-07 16:22:04 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-07 16:22:04 -0400
commitda62f63aad914521d97a565453f3e2f262161666 (patch)
tree47b64cde7dcb8cff246ef574a2a68872ec95c535 /widgets
parentfca7321639f77bbf825dc897156d7a21993a2c69 (diff)
downloadaerc-da62f63aad914521d97a565453f3e2f262161666.tar.gz
Truncate long subject lines
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msglist.go6
1 files changed, 5 insertions, 1 deletions
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