Avoid deadlock when preloading (#2236)
* Fix preload deadlock * Add experimental flag
This commit is contained in:
1 parent
928bf9e3bd
commit
fc2b2f42a2
2 files changed
+9
-3
No files matched your search
+1
-1
@@ -25,7 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|||||||
- A new command `cmd-menu-discard` is added to allow exiting the completion menu with completions discarded (#2146).
|
- A new command `cmd-menu-discard` is added to allow exiting the completion menu with completions discarded (#2146).
|
||||||
- The `lf_mode` environment variable will now be set to `compmenu` if the completion menu is active (#2146).
|
- The `lf_mode` environment variable will now be set to `compmenu` if the completion menu is active (#2146).
|
||||||
- A `ruler` config file is added as an alternate method for customizing the ruler (#2186). This is intended to eventually replace the existing `rulerfmt`/`statfmt` options and must be enabled using the new `rulerfile` option. **This feature is currently experimental.**
|
- A `ruler` config file is added as an alternate method for customizing the ruler (#2186). This is intended to eventually replace the existing `rulerfmt`/`statfmt` options and must be enabled using the new `rulerfile` option. **This feature is currently experimental.**
|
||||||
- A new option `preload` is added to enable calling the `previewer` to generate previews in advance (#2206).
|
- A new option `preload` is added to enable calling the `previewer` to generate previews in advance (#2206). **This feature is currently experimental.**
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -827,7 +827,10 @@ func (nav *nav) preload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nav.regCache[file.path] = ®{loading: true, loadTime: time.Now(), path: file.path}
|
nav.regCache[file.path] = ®{loading: true, loadTime: time.Now(), path: file.path}
|
||||||
nav.preloadChan <- file.path
|
select {
|
||||||
|
case nav.preloadChan <- file.path:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.startPreview()
|
nav.startPreview()
|
||||||
@@ -914,7 +917,10 @@ func (nav *nav) loadReg(path string, volatile bool) *reg {
|
|||||||
nav.regCache[path] = r
|
nav.regCache[path] = r
|
||||||
nav.startPreview()
|
nav.startPreview()
|
||||||
if gOpts.preload {
|
if gOpts.preload {
|
||||||
nav.preloadChan <- path
|
select {
|
||||||
|
case nav.preloadChan <- path:
|
||||||
|
default:
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
nav.previewChan <- path
|
nav.previewChan <- path
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user