Refactor previewable logic (#2235)

This commit is contained in:
Joe Lim authored and GitHub committed 2025-10-28 15:27:59 +11:00
1 parent fc4b3637bb
commit 928bf9e3bd
2 files changed
+15 -3

No files matched your search

+13 -1
View File
@@ -142,6 +142,18 @@ func (file *file) TotalSize() int64 {
return file.Size()
}
func (file *file) isPreviewable() bool {
if file.Mode().IsRegular() {
return true
}
if file.IsDir() && gOpts.dirpreviews {
return true
}
return false
}
type fakeStat struct {
name string
}
@@ -806,7 +818,7 @@ func (nav *nav) preload() {
}
file := dir.files[i]
if !(file.Mode().IsRegular() || (file.IsDir() && gOpts.dirpreviews)) {
if !file.isPreviewable() {
return
}