check hiddenfiles option for dir updates

Related #476
This commit is contained in:
Gokcehan 2020-10-02 21:50:55 +03:00
parent cf79726d21
commit 88749a3da1

5
nav.go
View File

@ -9,6 +9,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"reflect"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -112,6 +113,7 @@ type dir struct {
files []*file // displayed files in directory including or excluding hidden ones files []*file // displayed files in directory including or excluding hidden ones
allFiles []*file // all files in directory including hidden ones (same array as files) allFiles []*file // all files in directory including hidden ones (same array as files)
sortType sortType // sort method and options from last sort 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 noPerm bool // whether lf has no permission to open the directory
} }
@ -134,6 +136,7 @@ func newDir(path string) *dir {
func (dir *dir) sort() { func (dir *dir) sort() {
dir.sortType = gOpts.sortType dir.sortType = gOpts.sortType
dir.hiddenfiles = gOpts.hiddenfiles
dir.files = dir.allFiles dir.files = dir.allFiles
@ -318,7 +321,7 @@ func (nav *nav) checkDir(dir *dir) {
nd.sort() nd.sort()
nav.dirChan <- nd nav.dirChan <- nd
}() }()
case dir.sortType != gOpts.sortType: case dir.sortType != gOpts.sortType || !reflect.DeepEqual(dir.hiddenfiles, gOpts.hiddenfiles):
dir.loading = true dir.loading = true
go func() { go func() {
dir.sort() dir.sort()