aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msglist.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-05-28 10:32:42 -0400
committerDrew DeVault <sir@cmpwn.com>2020-05-28 10:32:42 -0400
commitcaad1b2c06a0446059ee5ee916e3dce1794b159b (patch)
treeee81255485234137a5902d87d5960ac06618b341 /widgets/msglist.go
parent76a91813d8dc0f0011202f8120fc197097f022aa (diff)
downloadaerc-caad1b2c06a0446059ee5ee916e3dce1794b159b.tar.gz
Revert "Add Style configuration"
This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r--widgets/msglist.go55
1 files changed, 18 insertions, 37 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 5d12f8e3..5aedb446 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -3,7 +3,6 @@ package widgets
import (
"fmt"
"log"
- "time"
"github.com/gdamore/tcell"
"github.com/mattn/go-runewidth"
@@ -50,8 +49,7 @@ func (ml *MessageList) Invalidate() {
func (ml *MessageList) Draw(ctx *ui.Context) {
ml.height = ctx.Height()
- ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ',
- ml.aerc.SelectedAccount().UiConfig().GetStyle(config.STYLE_MSGLIST_DEFAULT))
+ ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault)
store := ml.Store()
if store == nil {
@@ -86,50 +84,34 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
continue
}
- uiConfig := ml.conf.GetUiConfig(map[config.ContextType]string{
- config.UI_CONTEXT_ACCOUNT: ml.aerc.SelectedAccount().AccountConfig().Name,
- config.UI_CONTEXT_FOLDER: ml.aerc.SelectedAccount().Directories().Selected(),
- config.UI_CONTEXT_SUBJECT: msg.Envelope.Subject,
- })
-
- so := config.STYLE_MSGLIST_DEFAULT
+ style := tcell.StyleDefault
+ // current row
+ if row == ml.store.SelectedIndex()-ml.scroll {
+ style = style.Reverse(true)
+ }
// deleted message
if _, ok := store.Deleted[msg.Uid]; ok {
- so = config.STYLE_MSGLIST_DELETED
+ style = style.Foreground(tcell.ColorGray)
}
// unread message
seen := false
- flaged := false
for _, flag := range msg.Flags {
- switch flag {
- case models.SeenFlag:
+ if flag == models.SeenFlag {
seen = true
- case models.FlaggedFlag:
- flaged = true
}
}
if !seen {
- so = config.STYLE_MSGLIST_UNREAD
- }
-
- if flaged {
- so = config.STYLE_MSGLIST_FLAGGED
- }
-
- // marked message
- if store.IsMarked(msg.Uid) {
- so = config.STYLE_MSGLIST_MARKED
- }
-
- style := uiConfig.GetStyle(so)
-
- // current row
- if row == ml.store.SelectedIndex()-ml.scroll {
- style = uiConfig.GetStyleSelected(so)
+ style = style.Bold(true)
}
ctx.Fill(0, row, ctx.Width(), 1, ' ', style)
+ uiConfig := ml.conf.GetUiConfig(map[config.ContextType]string{
+ config.UI_CONTEXT_ACCOUNT: ml.aerc.SelectedAccount().AccountConfig().Name,
+ config.UI_CONTEXT_FOLDER: ml.aerc.SelectedAccount().Directories().Selected(),
+ config.UI_CONTEXT_SUBJECT: msg.Envelope.Subject,
+ })
+
fmtStr, args, err := format.ParseMessageFormat(
ml.aerc.SelectedAccount().acct.From,
uiConfig.IndexFormat,
@@ -186,7 +168,7 @@ func (ml *MessageList) MouseEvent(localX int, localY int, event tcell.Event) {
lib.NewMessageStoreView(msg, store, ml.aerc.DecryptKeys,
func(view lib.MessageView, err error) {
if err != nil {
- ml.aerc.PushError(err.Error(), 10*time.Second)
+ ml.aerc.PushError(err.Error())
return
}
viewer := NewMessageViewer(acct, ml.aerc.Config(), view)
@@ -306,8 +288,7 @@ func (ml *MessageList) Scroll() {
}
func (ml *MessageList) drawEmptyMessage(ctx *ui.Context) {
- uiConfig := ml.aerc.SelectedAccount().UiConfig()
- msg := uiConfig.EmptyMessage
+ msg := ml.aerc.SelectedAccount().UiConfig().EmptyMessage
ctx.Printf((ctx.Width()/2)-(len(msg)/2), 0,
- uiConfig.GetStyle(config.STYLE_MSGLIST_DEFAULT), "%s", msg)
+ tcell.StyleDefault, "%s", msg)
}