init navigation after evaluation of config file

cc #748 #759
This commit is contained in:
Gokcehan committed 2022-03-11 15:21:27 +03:00
1 parent 8954e9f16a
commit 089e6dc705
4 files changed
+147 -23

No files matched your search

+6 -9
View File
@@ -328,6 +328,7 @@ func (dir *dir) sel(name string, height int) {
}
type nav struct {
init bool
dirs []*dir
copyBytes int64
copyTotal int64
@@ -460,11 +461,6 @@ func (nav *nav) getDirs(wd string) {
}
func newNav(height int) *nav {
wd, err := os.Getwd()
if err != nil {
log.Printf("getting current directory: %s", err)
}
nav := &nav{
copyBytesChan: make(chan int64, 1024),
copyTotalChan: make(chan int64, 1024),
@@ -486,9 +482,6 @@ func newNav(height int) *nav {
jumpListInd: -1,
}
nav.getDirs(wd)
nav.addJumpList()
return nav
}
@@ -558,6 +551,10 @@ func (nav *nav) reload() error {
}
func (nav *nav) position() {
if (!nav.init) {
return
}
path := nav.currDir().path
for i := len(nav.dirs) - 2; i >= 0; i-- {
nav.dirs[i].sel(filepath.Base(path), nav.height)
@@ -1593,7 +1590,7 @@ func (nav *nav) currFileOrSelections() (list []string, err error) {
return nav.currSelections(), nil
}
func (nav *nav) getDirSize() error {
func (nav *nav) calcDirSize() error {
calc := func(f *file) error {
if f.IsDir() {