aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msglist.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-07-05 14:48:41 -0500
committerRobin Jarry <robin@jarry.cc>2022-07-10 21:15:12 +0200
commita953e4dbe914def4275a6ddfc16e3046804fe03e (patch)
tree1f13c056b0f80caf5f2d9ac00792839ed198f14d /widgets/msglist.go
parentc2f4404fca15be37228545b1893f5fa335168337 (diff)
downloadaerc-a953e4dbe914def4275a6ddfc16e3046804fe03e.tar.gz
threading: refactor reselect logic
This patch refactors reselection of a message during certain operations (searching, filtering, clearing, deleting, moving, new message arrival). The addition of server-side filtering for threaded views broke the existing reselection logic. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r--widgets/msglist.go22
1 files changed, 1 insertions, 21 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 9e68f219..e9603cae 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -345,27 +345,7 @@ func (ml *MessageList) storeUpdate(store *lib.MessageStore) {
if ml.Store() != store {
return
}
- uids := store.Uids()
-
- if len(uids) > 0 {
- // When new messages come in, advance the cursor accordingly
- // Note that this assumes new messages are appended to the top, which
- // isn't necessarily true once we implement SORT... ideally we'd look
- // for the previously selected UID.
- if len(uids) > ml.nmsgs && ml.nmsgs != 0 {
- for i := 0; i < len(uids)-ml.nmsgs; i++ {
- ml.Store().Next()
- }
- }
- if len(uids) < ml.nmsgs && ml.nmsgs != 0 {
- for i := 0; i < ml.nmsgs-len(uids); i++ {
- ml.Store().Prev()
- }
- }
- ml.nmsgs = len(uids)
- }
-
- ml.Invalidate()
+ store.Reselect()
}
func (ml *MessageList) SetStore(store *lib.MessageStore) {