cache file previews in memory

Related #5 and #92
This commit is contained in:
Gokcehan committed 2018-02-10 18:59:19 +03:00
1 parent 288561a9ba
commit 55ef28b4c7
3 files changed
+102 -84

No files matched your search

+6 -4
View File
@@ -99,7 +99,7 @@ func (app *app) loop() {
curr, err := app.nav.currFile()
if err == nil {
if d.path == app.nav.currDir().path {
app.nav.load(curr.path)
app.ui.loadFile(app.nav)
}
if d.path == curr.path {
app.ui.dirPrev = d
@@ -107,11 +107,13 @@ func (app *app) loop() {
}
app.ui.draw(app.nav)
case p := <-app.ui.prevChan:
case r := <-app.nav.regChan:
app.nav.regCache[r.path] = r
curr, err := app.nav.currFile()
if err == nil {
if p.path == curr.path {
app.ui.regPrev = p.lines
if r.path == curr.path {
app.ui.regPrev = r
}
}