summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/account/next-folder.go10
-rw-r--r--lib/msgstore.go6
-rw-r--r--widgets/dirlist.go6
3 files changed, 10 insertions, 12 deletions
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
}
diff --git a/lib/msgstore.go b/lib/msgstore.go
index b346129..1061c8e 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -337,7 +337,7 @@ func (store *MessageStore) Select(index int) {
}
}
-func (store *MessageStore) nextPrev(delta int) {
+func (store *MessageStore) NextPrev(delta int) {
uids := store.Uids()
if len(uids) == 0 {
return
@@ -361,11 +361,11 @@ func (store *MessageStore) nextPrev(delta int) {
}
func (store *MessageStore) Next() {
- store.nextPrev(1)
+ store.NextPrev(1)
}
func (store *MessageStore) Prev() {
- store.nextPrev(-1)
+ store.NextPrev(-1)
}
func (store *MessageStore) Search(c *imap.SearchCriteria, cb func([]uint32)) {
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 078973a..b0807ae 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -136,7 +136,7 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
}
}
-func (dirlist *DirectoryList) nextPrev(delta int) {
+func (dirlist *DirectoryList) NextPrev(delta int) {
curIdx := sort.SearchStrings(dirlist.dirs, dirlist.selected)
if curIdx == len(dirlist.dirs) {
return
@@ -152,11 +152,11 @@ func (dirlist *DirectoryList) nextPrev(delta int) {
}
func (dirlist *DirectoryList) Next() {
- dirlist.nextPrev(1)
+ dirlist.NextPrev(1)
}
func (dirlist *DirectoryList) Prev() {
- dirlist.nextPrev(-1)
+ dirlist.NextPrev(-1)
}
// filterDirsByFoldersConfig sets dirlist.dirs to the filtered subset of the