summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorKevin Kuehler <keur@ocf.berkeley.edu>2019-07-21 18:26:37 -0700
committerDrew DeVault <sir@cmpwn.com>2019-07-25 08:26:43 -0400
commitfe2fef4b750e570361eabc849c1ec09fe5eda01d (patch)
treefe2b808599d2720811ed81fa7f1a4dd955319afb /lib
parent6c0f228451c171f4901fa214dd8252d2b22bceaa (diff)
downloadaerc-fe2fef4b750e570361eabc849c1ec09fe5eda01d.tar.gz
Make :next-result :prev-result relative to cursor
Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
Diffstat (limited to 'lib')
-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() {
view.go?h=0.6.0&id=89f1684ea4b5e680db7ff06a54b2d4e78212cd12'>^
58db517 ^

f3158b3 ^


58db517 ^

f3158b3 ^


58db517 ^

f3158b3 ^


58db517 ^

f3158b3 ^


58db517 ^
f3158b3 ^

58db517 ^
f3158b3 ^
0535f63 ^
f3158b3 ^

















13a6a3f ^
f3158b3 ^

13a6a3f ^
f3158b3 ^













1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133