store: fix nexprev when filtering

Select the first message with NextPrev when the cursor disappears after
applying a filter where the selected message is not part of. Currently,
the NextPrev would select the last message in the mailbox (like a G
jump).

To reproduce:
1) select a message
2) apply a filter where the selected message is not selected
3) move the cursor and it will jump to the last message

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Koni Marti 2022-07-31 22:20:24 +02:00 committed by Robin Jarry
parent 0c85b5a6cf
commit 687c4777b5

View file

@ -696,6 +696,7 @@ func (store *MessageStore) NextPrev(delta int) {
newIdx := store.FindIndexByUid(uid)
if newIdx < 0 {
store.Select(uids[len(uids)-1])
return
}
newIdx -= delta