~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH] Remove dirs field and references to it

Details
Message ID
<20190630022932.31466-1-r@gnzler.io>
Sender timestamp
1561861772
DKIM signature
missing
Download raw message
Patch: +11 -10
This fixes prev/next-folder that broke after
546dfcd76dd228e0605359e9985f0b6a5672e8fa
---
 widgets/dirlist.go | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 944b72e..65fed9b 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -17,7 +17,6 @@ type DirectoryList struct {
	acctConf  *config.AccountConfig
	uiConf    *config.UIConfig
	store     *lib.DirStore
	dirs      []string
	logger    *log.Logger
	selecting string
	selected  string
@@ -44,7 +43,7 @@ func NewDirectoryList(acctConf *config.AccountConfig, uiConf *config.UIConfig,
}

func (dirlist *DirectoryList) List() []string {
	return dirlist.dirs
	return dirlist.store.List()
}

func (dirlist *DirectoryList) UpdateList(done func(dirs []string)) {
@@ -78,16 +77,18 @@ func (dirlist *DirectoryList) Select(name string) {
				dirlist.selected = dirlist.selecting
				dirlist.filterDirsByFoldersConfig()
				hasSelected := false
				for _, d := range dirlist.dirs {
				dirs := dirlist.store.List()
				for _, d := range dirs {
					if d == dirlist.selected {
						hasSelected = true
						break
					}
				}
				if !hasSelected && dirlist.selected != "" {
					dirlist.dirs = append(dirlist.dirs, dirlist.selected)
					dirs = append(dirs, dirlist.selected)
				}
				sort.Strings(dirlist.dirs)
				sort.Strings(dirs)
				dirlist.store.Update(dirs)
			}
			dirlist.Invalidate()
		})
@@ -139,10 +140,10 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
}

func (dirlist *DirectoryList) nextPrev(delta int) {
	for i, dir := range dirlist.dirs {
	for i, dir := range dirlist.store.List() {
		if dir == dirlist.selected {
			var j int
			ndirs := len(dirlist.dirs)
			ndirs := len(dirlist.store.List())
			for j = i + delta; j != i; j += delta {
				if j < 0 {
					j = ndirs - 1
@@ -150,7 +151,7 @@ func (dirlist *DirectoryList) nextPrev(delta int) {
				if j >= ndirs {
					j = 0
				}
				name := dirlist.dirs[j]
				name := dirlist.store.List()[j]
				if len(dirlist.acctConf.Folders) > 1 && name != dirlist.selected {
					idx := sort.SearchStrings(dirlist.acctConf.Folders, name)
					if idx == len(dirlist.acctConf.Folders) ||
@@ -161,7 +162,7 @@ func (dirlist *DirectoryList) nextPrev(delta int) {
				}
				break
			}
			dirlist.Select(dirlist.dirs[j])
			dirlist.Select(dirlist.store.List()[j])
			break
		}
	}
@@ -191,5 +192,5 @@ func (dirlist *DirectoryList) filterDirsByFoldersConfig() {
			}
		}
	}
	dirlist.dirs = filtered
	dirlist.store.Update(filtered)
}
-- 
2.22.0
Details
Message ID
<BV6PT9WRMB16.16DDFWUTXGJTE@homura>
In-Reply-To
<20190630022932.31466-1-r@gnzler.io> (view parent)
Sender timestamp
1561861835
DKIM signature
missing
Download raw message
On Sun Jun 30, 2019 at 4:29 AM Robert Günzler wrote:
> This fixes prev/next-folder that broke after
> 546dfcd76dd228e0605359e9985f0b6a5672e8fa

Hmm, prev/next-folder works fine for me.
Robert Guenzler
Details
Message ID
<BV6QJZI89ZBQ.16DDFWUTXGJTE@hibiki>
In-Reply-To
<BV6PT9WRMB16.16DDFWUTXGJTE@homura> (view parent)
Sender timestamp
1561863928
DKIM signature
missing
Download raw message
On Sat Jun 29, 2019 at 10:30 PM Drew DeVault wrote:
> Hmm, prev/next-folder works fine for me.

it does? I just tried with a clean build from master and default configs
and still no luck...

and looking at the code in `widget/dirlist.go` I don't understand how it
can work?

The loop in `nextPrev` only looks at the `dirlist.dirs` but that field
never even gets initialized or updated. `UpdateList` only puts new
directories it finds into the new store.

This was part of Greg's patch series for completion support, could I be
missing some part of it for some weird reason...?
Details
Message ID
<BV757GH6QXQP.16DDFWUTXGJTE@homura>
In-Reply-To
<BV6QJZI89ZBQ.16DDFWUTXGJTE@hibiki> (view parent)
Sender timestamp
1561905263
DKIM signature
missing
Download raw message
Beats me. I am definitely able to use :next/:prev-folder. In any case,
your patch makes the code better, so I applied it:

To git.sr.ht:~sircmpwn/aerc
   5b4e592..0e55637  master -> master

Thanks!
Reply to thread Export thread (mbox)