Pad/internal/browser
Greg Pomerantz 16740b0de0 Browser: keep the file list live (re-read on change, re-sort, no idle frames)
The browser list was cached: files added/removed/renamed, or whose mtime
changed, did not show up (and did not re-sort) until the user navigated
away and back in. In particular, opening a file and returning showed a
stale list — a new file created elsewhere only appeared after navigating
up and back down.

The browser now re-reads the current directory while it is on screen:

- A short (~1 s) timer re-reads the visible directory so external changes
  (including inbound syncs) appear live, re-sorted in the current sort
  mode. A landing re-index repopulates the visible+prefetch pages
  synchronously (no flicker), preserves the scroll offset, and re-filters
  an active search without a scroll jump.
- Returning to the browser from the editor triggers one immediate re-read
  so the list is current the moment you land back.
- Bounded to one read per directory: a refresh while a read of the same
  directory is in flight coalesces, and a stale result for a directory the
  user has since left is dropped rather than clobbering the current view.
- A failed background refresh keeps the last good view (the next tick
  retries); a failed navigation still recovers to the previous directory.
- Change detection: a refresh that finds the directory unchanged rebuilds
  nothing and emits no frame, preserving the event-driven emission
  contract (TestNoFramesWhileIdle_Browser) while the browser idles.

Verified on-device: external add while sitting in the browser appears and
re-sorts to the top within ~1 s; an external add+remove made while in the
editor is reflected immediately on return; an external delete drops the
row within ~1 s.
2026-09-02 18:23:16 -04:00
..
browser_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
browser.go Browser: keep the file list live (re-read on change, re-sort, no idle frames) 2026-09-02 18:23:16 -04:00
handlers.go chore: remove per-event debug logging from the normal path 2026-08-16 20:58:49 -04:00
index_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
index.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
layout_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
layout.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
lazy_loading_test.go Browser: keep the file list live (re-read on change, re-sort, no idle frames) 2026-09-02 18:23:16 -04:00
manager_test.go Browser: keep the file list live (re-read on change, re-sort, no idle frames) 2026-09-02 18:23:16 -04:00
manager.go Browser: keep the file list live (re-read on change, re-sort, no idle frames) 2026-09-02 18:23:16 -04:00
navigation_test.go Integrate real filesystem with interface abstraction 2026-06-04 16:19:38 -04:00
pixel_scroll_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
scroll_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
search_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
search.go Fix bugs in e2e tests and remove list item selection highlight 2026-06-02 13:30:09 -04:00
sort_test.go Add e2e test harness for testing editor logic without Gio display 2026-05-31 08:56:30 -04:00
sort.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
types_test.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00
types.go gofmt: format all remaining files with the go1.27 toolchain 2026-08-23 10:03:27 -04:00