From 507c90537c66289633af4b26abddcfd50a2a29d0 Mon Sep 17 00:00:00 2001 From: Jelle Besseling Date: Sun, 4 Aug 2019 16:09:48 +0200 Subject: 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 --- commands/msgview/next.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'commands/msgview/next.go') 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 { -- cgit v1.2.3