Make :next-result :prev-result relative to cursor

Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
This commit is contained in:
Kevin Kuehler 2019-07-21 18:26:37 -07:00 committed by Drew DeVault
parent 6c0f228451
commit fe2fef4b75
1 changed files with 9 additions and 0 deletions

View File

@ -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() {