sort cached directories asynchronously

This commit is contained in:
Gokcehan 2018-04-20 21:28:56 +03:00
parent a0e1d4d59a
commit 3b043752a4

15
nav.go
View File

@ -330,15 +330,22 @@ func (nav *nav) loadDir(path string) *dir {
d.ind, d.pos = 0, 0
nav.dirChan <- d
}()
d := &dir{loading: true, path: path}
d := &dir{loading: true, path: path, sortType: gOpts.sortType}
nav.dirCache[path] = d
return d
}
if d.sortType != gOpts.sortType {
name := d.name()
d.sort()
d.find(name, nav.height)
go func() {
d.loading = true
name := d.name()
d.sort()
d.find(name, nav.height)
d.loading = false
nav.dirChan <- d
}()
}
return d
}