aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msglist.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-12-21 11:31:04 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-04 22:57:31 +0100
commit5677f93ff8e0f212be112a110fcfe09663c84f98 (patch)
tree9f47f430b312d1f0dc1acdd3735cfd76ad21e0f0 /widgets/msglist.go
parent36fded03e762da97edde61559c8bf60d5749d6a2 (diff)
downloadaerc-5677f93ff8e0f212be112a110fcfe09663c84f98.tar.gz
model: change flags array to bitmask
Using a list of integers is not optimal. Use a bit mask instead. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r--widgets/msglist.go16
1 files changed, 2 insertions, 14 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 842e2911..c260da1c 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -208,25 +208,13 @@ func (ml *MessageList) drawRow(textWidth int, ctx *ui.Context, uid uint32, row i
}
msg_styles := []config.StyleObject{}
- // unread message
- seen := false
- flagged := false
- for _, flag := range msg.Flags {
- switch flag {
- case models.SeenFlag:
- seen = true
- case models.FlaggedFlag:
- flagged = true
- }
- }
-
- if seen {
+ if msg.Flags.Has(models.SeenFlag) {
msg_styles = append(msg_styles, config.STYLE_MSGLIST_READ)
} else {
msg_styles = append(msg_styles, config.STYLE_MSGLIST_UNREAD)
}
- if flagged {
+ if msg.Flags.Has(models.FlaggedFlag) {
msg_styles = append(msg_styles, config.STYLE_MSGLIST_FLAGGED)
}