From 3650b72ca64b9fb6a7e7b058ad6ef67894c2866d Mon Sep 17 00:00:00 2001
From: Jelle Besseling <jelle@pingiun.com>
Date: Sun, 4 Aug 2019 16:05:06 +0200
Subject: Implement next-folder using NextPrev with amount

This fixes ~sircmpwn/aerc2#182

https://todo.sr.ht/~sircmpwn/aerc2/182
---
 commands/account/next-folder.go | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'commands')

diff --git a/commands/account/next-folder.go b/commands/account/next-folder.go
index 414e606..537a351 100644
--- a/commands/account/next-folder.go
+++ b/commands/account/next-folder.go
@@ -40,12 +40,10 @@ func (_ NextPrevFolder) Execute(aerc *widgets.Aerc, args []string) error {
 	if acct == nil {
 		return errors.New("No account selected")
 	}
-	for ; n > 0; n-- {
-		if args[0] == "prev-folder" {
-			acct.Directories().Prev()
-		} else {
-			acct.Directories().Next()
-		}
+	if args[0] == "prev-folder" {
+		acct.Directories().NextPrev(-n)
+	} else {
+		acct.Directories().NextPrev(n)
 	}
 	return nil
 }
-- 
cgit v1.2.3