A simple, high performance text editor.
Replace the 1 s polling re-read of the browser directory with an inotify watch (dirWatcher, internal/editor/dirwatcher.go) using golang.org/x/sys/unix, which is already in the build list — no new dependency, no go.mod change. - The watcher watches the current browser directory and coalesces a burst of events to at most one token; the owner re-reads on the token. Create, delete, rename, modify, and attrib (mtime) changes are all covered, so an inbound sync that touches a file's mtime re-sorts the list in the current sort mode. - The watch is re-pointed when the directory changes (a no-op while the path is unchanged) and is closed when the logic goroutine exits (covers both Shutdown and the test harness Done+WaitForExit path). - A slow 30 s backstop rescan remains as a safety net for the rare event the FUSE inotify layer drops (syncthing uses the same inotify+rescan pattern on Android). The change-detection from the previous commit means the backstop emits no frame when nothing changed, so TestNoFramesWhileIdle_Browser still holds. - If inotify is unavailable (newDirWatcher returns nil) or a watch add fails, the 30 s backstop is the only path — a graceful degradation, not a break. Verified on-device (Notes dir, Date-descending): an external add appears at the top in well under a second (impossibly fast for the 30 s backstop, so the inotify path); touching a file's mtime re-sorts it to the top; a delete drops the row. All sub-second. |
||
|---|---|---|
| .qwen | ||
| cmd/pad | ||
| doc | ||
| internal | ||
| scripts | ||
| tools/touchinject | ||
| .DS_Store | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||