From 88749a3da1a28351b60fef78c4aa146809f403fd Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Fri, 2 Oct 2020 21:50:55 +0300 Subject: [PATCH] check hiddenfiles option for dir updates Related #476 --- nav.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/nav.go b/nav.go index 2a3ae07..2e55308 100644 --- a/nav.go +++ b/nav.go @@ -9,6 +9,7 @@ import ( "os" "os/exec" "path/filepath" + "reflect" "sort" "strconv" "strings" @@ -104,15 +105,16 @@ func readdir(path string) ([]*file, error) { } type dir struct { - loading bool // directory is loading from disk - loadTime time.Time // current loading or last load time - ind int // index of current entry in files - pos int // position of current entry in ui - path string // full path of directory - files []*file // displayed files in directory including or excluding hidden ones - allFiles []*file // all files in directory including hidden ones (same array as files) - sortType sortType // sort method and options from last sort - noPerm bool // whether lf has no permission to open the directory + loading bool // directory is loading from disk + loadTime time.Time // current loading or last load time + ind int // index of current entry in files + pos int // position of current entry in ui + path string // full path of directory + files []*file // displayed files in directory including or excluding hidden ones + allFiles []*file // all files in directory including hidden ones (same array as files) + sortType sortType // sort method and options from last sort + hiddenfiles []string // hiddenfiles value from last sort + noPerm bool // whether lf has no permission to open the directory } func newDir(path string) *dir { @@ -134,6 +136,7 @@ func newDir(path string) *dir { func (dir *dir) sort() { dir.sortType = gOpts.sortType + dir.hiddenfiles = gOpts.hiddenfiles dir.files = dir.allFiles @@ -318,7 +321,7 @@ func (nav *nav) checkDir(dir *dir) { nd.sort() nav.dirChan <- nd }() - case dir.sortType != gOpts.sortType: + case dir.sortType != gOpts.sortType || !reflect.DeepEqual(dir.hiddenfiles, gOpts.hiddenfiles): dir.loading = true go func() { dir.sort()