about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/msgstore.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index baf8ee4..736217e 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -321,6 +321,15 @@ func (store *MessageStore) nextPrev(delta int) {
 	if store.selected >= len(store.uids) {
 		store.selected = len(store.uids) - 1
 	}
+	nextResultIndex := len(store.results) - store.resultIndex - 2*delta
+	if nextResultIndex < 0 || nextResultIndex >= len(store.results) {
+		return
+	}
+	nextResultUid := store.results[nextResultIndex]
+	selectedUid := store.uids[len(store.uids)-store.selected-1]
+	if nextResultUid == selectedUid {
+		store.resultIndex += delta
+	}
 }
 
 func (store *MessageStore) Next() {