about summary refs log tree commit diff stats
path: root/commands/account/next-result.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-06-26 20:50:27 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-26 20:50:54 -0400
commit91a75cd98b705bd5e6689b154ecaca0e7c81630e (patch)
tree85fd35605953bad88f9ad2b3a5875f5490b59f09 /commands/account/next-result.go
parentccf5c02c3815efbe3b2e495cbc6eaca9f017aefd (diff)
downloadaerc-91a75cd98b705bd5e6689b154ecaca0e7c81630e.tar.gz
Implement :search, :next-result, :prev-result
Diffstat (limited to 'commands/account/next-result.go')
-rw-r--r--commands/account/next-result.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/commands/account/next-result.go b/commands/account/next-result.go
new file mode 100644
index 0000000..d89de56
--- /dev/null
+++ b/commands/account/next-result.go
@@ -0,0 +1,41 @@
+package account
+
+import (
+	"errors"
+	"fmt"
+
+	"git.sr.ht/~sircmpwn/aerc/widgets"
+)
+
+func init() {
+	register("next-result", NextPrevResult)
+	register("prev-result", NextPrevResult)
+}
+
+func nextPrevResultUsage(cmd string) error {
+	return errors.New(fmt.Sprintf("Usage: %s [<n>[%%]]", cmd))
+}
+
+func NextPrevResult(aerc *widgets.Aerc, args []string) error {
+	if len(args) > 1 {
+		return nextPrevResultUsage(args[0])
+	}
+	acct := aerc.SelectedAccount()
+	if acct == nil {
+		return errors.New("No account selected")
+	}
+	if args[0] == "prev-result" {
+		store := acct.Store()
+		if store != nil {
+			store.PrevResult()
+		}
+		acct.Messages().Scroll()
+	} else {
+		store := acct.Store()
+		if store != nil {
+			store.NextResult()
+		}
+		acct.Messages().Scroll()
+	}
+	return nil
+}
;sam@samwhited.com> 2019-05-30 17:20:20 -0500 committer Drew DeVault <sir@cmpwn.com> 2019-06-01 10:49:01 -0400 Remove more GNU-isms from Makefile' href='/akspecs/aerc/commit/Makefile?h=0.5.0&id=0bfb90baedbde0bb5a862e6a8fe9ec7e56d664e5'>0bfb90b ^
58bc15b ^
fc719e4 ^



58bc15b ^

fc719e4 ^
0bfb90b ^








f42724c ^

d30a6e3 ^
fc719e4 ^
0bfb90b ^


fc719e4 ^
eabdcff ^
fc719e4 ^
3874269 ^
3e7ac52 ^
7f540df ^
3874269 ^




c21ec37 ^
7f540df ^
d30a6e3 ^
7f540df ^
177651b ^


fc719e4 ^
d3b5a76 ^


















fc719e4 ^

d3b5a76 ^
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