Various fixes for updating dircounts with watch enabled (#1881)

* Fix file size bug when copying files

* Don't remove existing watches

* Bump fsnotify

* Ignore watching `/dev`
This commit is contained in:
Joe Lim authored and GitHub committed 2025-01-15 13:06:00 +11:00
1 parent 8bfa3a6d34
commit 2095efa661
5 files changed
+20 -22

No files matched your search

+4 -9
View File
@@ -427,7 +427,7 @@ func (app *app) loop() {
}
}
app.setWatchPaths()
app.addWatchPaths()
app.ui.draw(app.nav)
case r := <-app.nav.regChan:
@@ -442,12 +442,7 @@ func (app *app) loop() {
app.ui.draw(app.nav)
case f := <-app.nav.fileChan:
dirs := app.nav.dirs
if app.ui.dirPrev != nil {
dirs = append(dirs, app.ui.dirPrev)
}
for _, dir := range dirs {
for _, dir := range app.nav.dirCache {
if dir.path != filepath.Dir(f.path) {
continue
}
@@ -638,7 +633,7 @@ func (app *app) runShell(s string, args []string, prefix string) {
}
}
func (app *app) setWatchPaths() {
func (app *app) addWatchPaths() {
if !gOpts.watch || len(app.nav.dirs) == 0 {
return
}
@@ -654,5 +649,5 @@ func (app *app) setWatchPaths() {
}
}
app.watch.set(paths)
app.watch.add(paths)
}