feat: pass special files to previewer script (#2327)
This commit is contained in:
1 parent
57d02dd01d
commit
c1b979371a
2 files changed
+15
-9
No files matched your search
@@ -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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user