diff options
author | Yash Srivastav <yash111998@gmail.com> | 2019-06-08 18:40:14 +0530 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-08 10:59:51 -0400 |
commit | 5f651b32e535716d99a9c1bea7c0ab5826bd633c (patch) | |
tree | f9b5f64959a6f9ebb21b827a483dbed249338118 /widgets | |
parent | 06e1b45a7851b58ea0d238f1fbfa2e8cee7bba8f (diff) | |
download | aerc-5f651b32e535716d99a9c1bea7c0ab5826bd633c.tar.gz |
msglist: use distinct style for unread emails
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/msglist.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go index 89aa52f..1afe487 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -4,6 +4,7 @@ import ( "fmt" "log" + "github.com/emersion/go-imap" "github.com/gdamore/tcell" "github.com/mattn/go-runewidth" @@ -75,12 +76,26 @@ func (ml *MessageList) Draw(ctx *ui.Context) { } style := tcell.StyleDefault + + // current row if row == ml.selected-ml.scroll { style = style.Reverse(true) } + // deleted message if _, ok := store.Deleted[msg.Uid]; ok { style = style.Foreground(tcell.ColorGray) } + // unread message + seen := false + for _, flag := range msg.Flags { + if flag == imap.SeenFlag { + seen = true + } + } + if !seen { + style = style.Bold(true) + } + ctx.Fill(0, row, ctx.Width(), 1, ' ', style) fmtStr, args, err := lib.ParseIndexFormat(ml.conf, i, msg) if err != nil { |