fix: restrict preloading files (#2648)
* fix: restric preloading files * improve patch
This commit is contained in:
1 parent
fb668f12be
commit
9a3b84e672
2 files changed
+5
-13
No files matched your search
@@ -471,17 +471,6 @@ func (app *app) loop() {
|
|||||||
|
|
||||||
if r, ok := app.nav.regCache[f.path]; ok {
|
if r, ok := app.nav.regCache[f.path]; ok {
|
||||||
app.nav.checkReg(r)
|
app.nav.checkReg(r)
|
||||||
} else {
|
|
||||||
r = ®{loading: true, loadTime: time.Now(), path: f.path}
|
|
||||||
app.nav.regCache[f.path] = r
|
|
||||||
if gOpts.preload {
|
|
||||||
select {
|
|
||||||
case app.nav.preloadChan <- f.path:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
app.nav.previewChan <- f.path
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onLoad(app, []string{f.path})
|
onLoad(app, []string{f.path})
|
||||||
app.ui.draw(app.nav)
|
app.ui.draw(app.nav)
|
||||||
|
|||||||
@@ -1028,9 +1028,12 @@ func (ui *ui) drawPreview(nav *nav, context *dirContext) {
|
|||||||
|
|
||||||
if gOpts.preview {
|
if gOpts.preview {
|
||||||
if curr.isPreviewable() {
|
if curr.isPreviewable() {
|
||||||
if reg, ok := nav.regCache[curr.path]; ok {
|
reg, ok := nav.regCache[curr.path]
|
||||||
win.printReg(ui.screen, reg, &ui.sxScreen, nav.previewTimer)
|
if !ok {
|
||||||
|
// the shown file can lose its cache entry, e.g. a save that deletes and recreates it
|
||||||
|
reg = nav.loadReg(curr.path, false)
|
||||||
}
|
}
|
||||||
|
win.printReg(ui.screen, reg, &ui.sxScreen, nav.previewTimer)
|
||||||
} else if curr.IsDir() {
|
} else if curr.IsDir() {
|
||||||
ui.sxScreen.lastFile = ""
|
ui.sxScreen.lastFile = ""
|
||||||
dir := nav.getDir(curr.path)
|
dir := nav.getDir(curr.path)
|
||||||
|
|||||||
Reference in new issue
Block a user