msgstore: refactor NextPrev
Refactor NextPrev to use already existing selection methods and bounds checking Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
f8e6478d46
commit
4036f696ad
1 changed files with 2 additions and 7 deletions
|
@ -675,13 +675,8 @@ func (store *MessageStore) NextPrev(delta int) {
|
|||
if len(uids) == 0 {
|
||||
return
|
||||
}
|
||||
store.selected += delta
|
||||
if store.selected < 0 {
|
||||
store.selected = 0
|
||||
}
|
||||
if store.selected >= len(uids) {
|
||||
store.selected = len(uids) - 1
|
||||
}
|
||||
idx := store.SelectedIndex() + delta
|
||||
store.Select(idx)
|
||||
store.updateVisual()
|
||||
nextResultIndex := len(store.results) - store.resultIndex - 2*delta
|
||||
if nextResultIndex < 0 || nextResultIndex >= len(store.results) {
|
||||
|
|
Loading…
Reference in a new issue