diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-01-26 10:16:44 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-01-29 21:47:14 +0100 |
commit | a0bd1fcf786ca9156cf3b8837e0820e8b603bae3 (patch) | |
tree | 522c0a1bb455f71317359399b8225d3d368ea62b /widgets/dirlist.go | |
parent | 6b39c0dae1e1c42445a2d8557e48135b02fc729b (diff) | |
download | aerc-a0bd1fcf786ca9156cf3b8837e0820e8b603bae3.tar.gz |
dirlist: simplify getRUEString logic
Reuse the newly-added GetRUECount method to simplify getRUEString
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/dirlist.go')
-rw-r--r-- | widgets/dirlist.go | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go index 8e6fa751..93db0763 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -235,22 +235,15 @@ func (dirlist *DirectoryList) getDirString(name string, width int, recentUnseen } func (dirlist *DirectoryList) getRUEString(name string) string { - msgStore, ok := dirlist.MsgStore(name) - if !ok { - return "" - } - if !msgStore.DirInfo.AccurateCounts { - msgStore.DirInfo.Recent, msgStore.DirInfo.Unseen = countRUE(msgStore) - } - di := msgStore.DirInfo + r, u, e := dirlist.GetRUECount(name) rueString := "" switch { - case di.Recent > 0: - rueString = fmt.Sprintf("%d/%d/%d", di.Recent, di.Unseen, di.Exists) - case di.Unseen > 0: - rueString = fmt.Sprintf("%d/%d", di.Unseen, di.Exists) - case di.Exists > 0: - rueString = fmt.Sprintf("%d", di.Exists) + case r > 0: + rueString = fmt.Sprintf("%d/%d/%d", r, u, e) + case u > 0: + rueString = fmt.Sprintf("%d/%d", u, e) + case e > 0: + rueString = fmt.Sprintf("%d", e) } return rueString } |