From fa5d8d7a007aa0030a4b2bfb122dabab3e69ad4b Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 19 May 2019 18:21:02 -0400 Subject: Advance cursor after :delete and :move So that you can repeat the action on the next message if appropriate --- widgets/msglist.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'widgets') diff --git a/widgets/msglist.go b/widgets/msglist.go index f7398dc1..caa868f1 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -109,10 +109,6 @@ func (ml *MessageList) storeUpdate(store *lib.MessageStore) { } if len(store.Uids) > 0 { - // Prevent selecting beyond the last message - for ml.selected >= len(store.Uids) { - ml.Prev() - } // 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 @@ -122,6 +118,11 @@ func (ml *MessageList) storeUpdate(store *lib.MessageStore) { ml.Next() } } + if len(store.Uids) < ml.nmsgs && ml.nmsgs != 0 { + for i := 0; i < ml.nmsgs-len(store.Uids); i++ { + ml.Prev() + } + } ml.nmsgs = len(store.Uids) } -- cgit