parent
cf79726d21
commit
88749a3da1
23
nav.go
23
nav.go
@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -104,15 +105,16 @@ func readdir(path string) ([]*file, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type dir struct {
|
type dir struct {
|
||||||
loading bool // directory is loading from disk
|
loading bool // directory is loading from disk
|
||||||
loadTime time.Time // current loading or last load time
|
loadTime time.Time // current loading or last load time
|
||||||
ind int // index of current entry in files
|
ind int // index of current entry in files
|
||||||
pos int // position of current entry in ui
|
pos int // position of current entry in ui
|
||||||
path string // full path of directory
|
path string // full path of directory
|
||||||
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
|
||||||
noPerm bool // whether lf has no permission to open the directory
|
hiddenfiles []string // hiddenfiles value from last sort
|
||||||
|
noPerm bool // whether lf has no permission to open the directory
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDir(path string) *dir {
|
func newDir(path string) *dir {
|
||||||
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user