diff options
author | Kevin Kuehler <keur@ocf.berkeley.edu> | 2019-07-21 18:26:37 -0700 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-25 08:26:43 -0400 |
commit | fe2fef4b750e570361eabc849c1ec09fe5eda01d (patch) | |
tree | fe2b808599d2720811ed81fa7f1a4dd955319afb /lib/msgstore.go | |
parent | 6c0f228451c171f4901fa214dd8252d2b22bceaa (diff) | |
download | aerc-fe2fef4b750e570361eabc849c1ec09fe5eda01d.zip |
Make :next-result :prev-result relative to cursor
Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
Diffstat (limited to 'lib/msgstore.go')
-rw-r--r-- | lib/msgstore.go | 9 |
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() { |