From 37f33ad65bfbfa69e620fcb0fdcff6393a251ac7 Mon Sep 17 00:00:00 2001 From: Kevin Kuehler Date: Mon, 28 Oct 2019 12:07:06 -0700 Subject: Rework threading and add REFERENCES * Implement a simplified version of the REFERENCES algorithm * Remove FormatThreads function * Instead of acting on all threads, handle each thread independently Signed-off-by: Kevin Kuehler --- widgets/msglist.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'widgets') diff --git a/widgets/msglist.go b/widgets/msglist.go index 228477d..df0366d 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -12,7 +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" + //"git.sr.ht/~sircmpwn/aerc/worker/types" ) type MessageList struct { @@ -71,16 +71,16 @@ func (ml *MessageList) Draw(ctx *ui.Context) { uids := store.Uids() if ml.conf.Ui.ThreadingEnabled { - threads := store.Threads + if store.ThreadRoot == nil { + return + } - 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 - }) + for i := ml.scroll; i < len(store.FlatThreads); i++ { + thread := store.FlatThreads[i] + if ml.drawRow(ctx, thread.Uid, row, row, &needsHeaders, string(thread.DrawThread())) { + break + } + row += 1 } } else { for i := len(uids) - 1 - ml.scroll; i >= 0; i-- { -- cgit v1.2.3