aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msglist.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index ac3d6cc..228477d 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -12,6 +12,7 @@ import (
"git.sr.ht/~sircmpwn/aerc/lib/format"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
"git.sr.ht/~sircmpwn/aerc/models"
+ "git.sr.ht/~sircmpwn/aerc/worker/types"
)
type MessageList struct {
@@ -69,12 +70,26 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
)
uids := store.Uids()
- for i := len(uids) - 1 - ml.scroll; i >= 0; i-- {
- uid := uids[i]
- if ml.drawRow(ctx, uid, i, row, &needsHeaders) {
- break
+ if ml.conf.Ui.ThreadingEnabled {
+ threads := store.Threads
+
+ for i := len(threads) - 1; i >= 0; i-- {
+ threads[i].FormatThread(func(thread *types.Thread, threadFmt []rune) bool {
+ if ml.drawRow(ctx, thread.Uid, row, row, &needsHeaders, string(threadFmt)) {
+ return true
+ }
+ row += 1
+ return false
+ })
+ }
+ } else {
+ for i := len(uids) - 1 - ml.scroll; i >= 0; i-- {
+ uid := uids[i]
+ if ml.drawRow(ctx, uid, i, row, &needsHeaders, "") {
+ break
+ }
+ row += 1
}
- row += 1
}
if len(uids) == 0 {
@@ -92,7 +107,7 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
// Draw one message.
//
// Return: If true, don't fetch any more messages
-func (ml *MessageList) drawRow(ctx *ui.Context, uid uint32, number int, row int, needsHeaders *[]uint32) bool {
+func (ml *MessageList) drawRow(ctx *ui.Context, uid uint32, number int, row int, needsHeaders *[]uint32, subjectThread string) bool {
store := ml.store
msg := store.Messages[uid]
@@ -130,7 +145,7 @@ func (ml *MessageList) drawRow(ctx *ui.Context, uid uint32, number int, row int,
ctx.Fill(0, row, ctx.Width(), 1, ' ', style)
fmtStr, args, err := format.ParseMessageFormat(
ml.conf.Ui.IndexFormat,
- ml.conf.Ui.TimestampFormat, "", number, msg)
+ ml.conf.Ui.TimestampFormat, "", number, msg, subjectThread)
if err != nil {
ctx.Printf(0, row, style, "%v", err)
} else {