From f5c9f2d0111527b5d5d2efed2e94a01b9f382709 Mon Sep 17 00:00:00 2001 From: cos Date: Tue, 26 Jul 2022 20:38:24 +0200 Subject: fixup: Hack up message list to be sorted ascending An attempt at making ascending or descending message list configurable. Seems to work for me, but a proper take on this might need to involve having to rethink what configuration options to present and how direct they map towards the operations happening under the hood. --- lib/threadbuilder.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lib/threadbuilder.go') diff --git a/lib/threadbuilder.go b/lib/threadbuilder.go index 334a846..a1954cb 100644 --- a/lib/threadbuilder.go +++ b/lib/threadbuilder.go @@ -145,16 +145,12 @@ func (builder *ThreadBuilder) sortThreads(threads []*types.Thread, orderedUids [ // RebuildUids rebuilds the uids from the given slice of threads func (builder *ThreadBuilder) RebuildUids(threads []*types.Thread) { uids := make([]uint32, 0, len(threads)) - for i := len(threads) - 1; i >= 0; i-- { + for i := 0; i < len(threads); i++ { threads[i].Walk(func(t *types.Thread, level int, currentErr error) error { uids = append(uids, t.Uid) return nil }) } - // copy in reverse as msgList displays backwards - for i, j := 0, len(uids)-1; i < j; i, j = i+1, j-1 { - uids[i], uids[j] = uids[j], uids[i] - } builder.threadedUids = uids } -- cgit v1.2.3