From 53d0c0a9030ce20ee98c2a0bdb221e73f647c16c Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Mon, 24 Feb 2020 20:12:16 +0100 Subject: widgets/dirlist: Fix total message count This fixes an issue with the updated count logic, where only fetched messages where counted to the exists string of the rue count. Note that the count is still broken (we only count read / unread messages we fetched, but that is the same behaviour as prior to the commit 66b68f35b3f3f3b97ec9951397fd75afeb0d0995) --- widgets/dirlist.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/widgets/dirlist.go b/widgets/dirlist.go index c000f52..600b38c 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -177,7 +177,10 @@ func (dirlist *DirectoryList) getRUEString(name string) string { totalUnseen = msgStore.DirInfo.Unseen totalExists = msgStore.DirInfo.Exists } else { - totalRecent, totalUnseen, totalExists = countRUE(msgStore) + totalRecent, totalUnseen = countRUE(msgStore) + // use the total count from the dirinfo, else we only count already + // fetched messages + totalExists = msgStore.DirInfo.Exists } rueString := "" if totalRecent > 0 { @@ -377,7 +380,7 @@ func (dirlist *DirectoryList) getSortCriteria() []*types.SortCriterion { return criteria } -func countRUE(msgStore *lib.MessageStore) (recent, unread, exist int) { +func countRUE(msgStore *lib.MessageStore) (recent, unread int) { for _, msg := range msgStore.Messages { if msg == nil { continue @@ -398,7 +401,6 @@ func countRUE(msgStore *lib.MessageStore) (recent, unread, exist int) { unread++ } } - exist++ } - return recent, unread, exist + return recent, unread } -- cgit v1.2.3