summary refs log tree commit diff stats
path: root/commands/msgview/next.go
diff options
context:
space:
mode:
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 {
/a> 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180