about summary refs log tree commit diff stats
path: root/widgets/msglist.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-26 20:52:34 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-26 20:52:34 -0400
commitbf02ad30ca118df09203ce34bba36a5fb9d5d450 (patch)
treef5e963fc5d454504dbd4417ca3ffb5adb1821b3e /widgets/msglist.go
parent91a75cd98b705bd5e6689b154ecaca0e7c81630e (diff)
downloadaerc-bf02ad30ca118df09203ce34bba36a5fb9d5d450.tar.gz
Fix jumping around in search
Diffstat (limited to 'widgets/msglist.go')
-rw-r--r--widgets/msglist.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 3f7e2b3..211cbce 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -184,14 +184,7 @@ func (ml *MessageList) Selected() *types.MessageInfo {
 func (ml *MessageList) Select(index int) {
 	store := ml.Store()
 	store.Select(index)
-
-	// I'm too lazy to do the math right now
-	for store.SelectedIndex()-ml.scroll >= ml.Height() {
-		ml.scroll += 1
-	}
-	for store.SelectedIndex()-ml.scroll < 0 {
-		ml.scroll -= 1
-	}
+	ml.Scroll()
 }
 
 func (ml *MessageList) Scroll() {
@@ -201,9 +194,11 @@ func (ml *MessageList) Scroll() {
 		return
 	}
 	if ml.Height() != 0 {
-		if store.SelectedIndex()-ml.scroll >= ml.Height() {
+		// I'm too lazy to do the math right now
+		for store.SelectedIndex()-ml.scroll >= ml.Height() {
 			ml.scroll += 1
-		} else if store.SelectedIndex()-ml.scroll < 0 {
+		}
+		for store.SelectedIndex()-ml.scroll < 0 {
 			ml.scroll -= 1
 		}
 	}
2018-06-01 16:56:41 -0700 Update go.mod' href='/akspecs/aerc/commit/go.mod?h=0.5.0&id=28021ede1bf6b2e2013b9db3fd22c85a3b6099a9'>28021ed ^
072bc26 ^
475b697 ^
28021ed ^

b0bf09b ^
513e8aa ^
16c3f0a ^
072bc26 ^
8d20e92 ^
43dba93 ^
072bc26 ^
3836d24 ^
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