Fix automatic scrolling when messages arrive/leave

This commit is contained in:
Drew DeVault 2019-06-11 10:08:44 -04:00
parent 0494c9ae9d
commit 408a9e7b10

View file

@ -137,12 +137,12 @@ func (ml *MessageList) storeUpdate(store *lib.MessageStore) {
// for the previously selected UID. // for the previously selected UID.
if len(store.Uids) > ml.nmsgs && ml.nmsgs != 0 { if len(store.Uids) > ml.nmsgs && ml.nmsgs != 0 {
for i := 0; i < len(store.Uids)-ml.nmsgs; i++ { for i := 0; i < len(store.Uids)-ml.nmsgs; i++ {
ml.Scroll() ml.Store().Next()
} }
} }
if len(store.Uids) < ml.nmsgs && ml.nmsgs != 0 { if len(store.Uids) < ml.nmsgs && ml.nmsgs != 0 {
for i := 0; i < ml.nmsgs-len(store.Uids); i++ { for i := 0; i < ml.nmsgs-len(store.Uids); i++ {
ml.Scroll() ml.Store().Prev()
} }
} }
ml.nmsgs = len(store.Uids) ml.nmsgs = len(store.Uids)