feat: pass special files to previewer script (#2327)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2025-12-29 02:31:14 +01:00
1 parent 57d02dd01d
commit c1b979371a
2 files changed
+15 -9

No files matched your search

+4
View File
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
## r41 (Unreleased)
### Changed
- The `previewer` script no longer skips non-regular files (#2327).
### Added
- A new server command `list` is added to print the IDs of all currently connected clients (#2314).
+11 -9
View File
@@ -144,15 +144,7 @@ func (file *file) TotalSize() int64 {
}
func (file *file) isPreviewable() bool {
if file.Mode().IsRegular() {
return true
}
if file.IsDir() && gOpts.dirpreviews {
return true
}
return false
return !file.IsDir() || gOpts.dirpreviews
}
type fakeStat struct {
@@ -934,6 +926,16 @@ func (nav *nav) preview(path string, win *win, mode string) {
defer out.Close()
reader = bufio.NewReader(out)
} else {
lstat, err := os.Lstat(path)
if err != nil {
log.Printf("lstat: %s", err)
return
}
if !lstat.Mode().IsRegular() {
return
}
f, err := os.Open(path)
if err != nil {
log.Printf("opening file: %s", err)