summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-20 17:03:37 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-20 17:03:37 -0400
commitd224487b6834aff5bb53f7042a142a7f3abe27b9 (patch)
tree524c2c05df2008e3ecacb3589bcf5e387900f2ea /widgets
parent0897413a3e7b7707e6e597077d1621e586180f3b (diff)
downloadaerc-d224487b6834aff5bb53f7042a142a7f3abe27b9.zip
Show attachment names in multipart view
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msgviewer.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 64762f7..e676478 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -255,9 +255,13 @@ func (ps *PartSwitcher) Draw(ctx *ui.Context) {
for i, part := range ps.parts {
style := tcell.StyleDefault.Reverse(ps.selected == i)
ctx.Fill(0, y+i, ctx.Width(), 1, ' ', style)
- ctx.Printf(len(part.index)*2, y+i, style, "%s/%s",
+ name := fmt.Sprintf("%s/%s",
strings.ToLower(part.part.MIMEType),
strings.ToLower(part.part.MIMESubType))
+ if filename, ok := part.part.DispositionParams["filename"]; ok {
+ name += fmt.Sprintf(" (%s)", filename)
+ }
+ ctx.Printf(len(part.index)*2, y+i, style, "%s", name)
}
ps.parts[ps.selected].Draw(ctx.Subcontext(
0, 0, ctx.Width(), ctx.Height()-height))