;fix:ui: fix file watcher to catch file overwrites

This commit is contained in:
Caleb Maclennan 2025-10-03 17:13:46 -06:00 committed by Simon Michael
parent 85a88327b3
commit a7c447a393

View File

@ -44,7 +44,7 @@ import Lens.Micro ((^.))
import System.Directory (canonicalizePath) import System.Directory (canonicalizePath)
import System.Environment (withProgName) import System.Environment (withProgName)
import System.FilePath (takeDirectory) import System.FilePath (takeDirectory)
import System.FSNotify (Event(Modified), watchDir, withManager, EventIsDirectory (IsFile)) import System.FSNotify (Event(Added, Modified), watchDir, withManager, EventIsDirectory (IsFile))
import Brick hiding (bsDraw) import Brick hiding (bsDraw)
import Brick.BChan qualified as BC import Brick.BChan qualified as BC
@ -305,9 +305,8 @@ runBrickUi uopts0@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=_iopts,reportspec_=r
d d
-- predicate: ignore changes not involving our files -- predicate: ignore changes not involving our files
(\case (\case
Modified f _ IsFile -> f `elem` files Added f _ IsFile -> f `elem` files -- for editors which write the whole file from scratch on saves
-- Added f _ -> f `elem` files Modified f _ IsFile -> f `elem` files -- for editors which modify existing files in place
-- Removed f _ -> f `elem` files
-- we don't handle adding/removing journal files right now -- we don't handle adding/removing journal files right now
-- and there might be some of those events from tmp files -- and there might be some of those events from tmp files
-- clogging things up so let's ignore them -- clogging things up so let's ignore them