summary refs log tree commit diff stats
path: root/commands/msgview/next.go
diff options
context:
space:
mode:
authorJelle Besseling <jelle@pingiun.com>2019-08-04 16:09:48 +0200
committerDrew DeVault <sir@cmpwn.com>2019-08-07 15:10:24 +0900
commit507c90537c66289633af4b26abddcfd50a2a29d0 (patch)
tree10ac19bd89b0911ade88c6999d3c37544e6058a3 /commands/msgview/next.go
parent3650b72ca64b9fb6a7e7b058ad6ef67894c2866d (diff)
downloadaerc-507c90537c66289633af4b26abddcfd50a2a29d0.tar.gz
Implement next-message in msgview using account
This makes sure that the next-message command accepts the same arguments
in the account view and the msgview
Diffstat (limited to 'commands/msgview/next.go')
-rw-r--r--commands/msgview/next.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/commands/msgview/next.go b/commands/msgview/next.go
index 82fb12f..647aafb 100644
--- a/commands/msgview/next.go
+++ b/commands/msgview/next.go
@@ -1,8 +1,7 @@
 package msgview
 
 import (
-	"errors"
-
+	"git.sr.ht/~sircmpwn/aerc/commands/account"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
 )
 
@@ -21,16 +20,16 @@ func (_ NextPrevMsg) Complete(aerc *widgets.Aerc, args []string) []string {
 }
 
 func (_ NextPrevMsg) Execute(aerc *widgets.Aerc, args []string) error {
+	err, n, pct := account.ParseNextPrevMessage(args)
+	if err != nil {
+		return err
+	}
 	mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
 	acct := mv.SelectedAccount()
 	store := mv.Store()
-	if acct == nil {
-		return errors.New("No account selected")
-	}
-	if args[0] == "prev-message" || args[0] == "prev" {
-		store.Prev()
-	} else {
-		store.Next()
+	err = account.ExecuteNextPrevMessage(args, acct, pct, n)
+	if err != nil {
+		return err
 	}
 	nextMsg := store.Selected()
 	if nextMsg == nil {
cc0deab1a10e9d5e54eec'>94ad882e ^
871d2227 ^
03d50cc8 ^
94ad882e ^

871d2227 ^








03d50cc8 ^
871d2227 ^












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