From 45ee5d125dd7e44f45fac6251f20d5e32e37b1f1 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 19 Sep 2022 17:56:01 -1000 Subject: [PATCH] imp: ui: support/require fsnotify 0.4.x --- hledger-ui/Hledger/UI/Main.hs | 5 ++--- hledger-ui/package.yaml | 2 +- stack.yaml | 1 + stack8.10.yaml | 1 + stack9.0.yaml | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hledger-ui/Hledger/UI/Main.hs b/hledger-ui/Hledger/UI/Main.hs index 707983257..231d18a41 100644 --- a/hledger-ui/Hledger/UI/Main.hs +++ b/hledger-ui/Hledger/UI/Main.hs @@ -23,7 +23,7 @@ import Graphics.Vty (mkVty, Mode (Mouse), Vty (outputIface), Output (setMode)) import Lens.Micro ((^.)) import System.Directory (canonicalizePath) import System.FilePath (takeDirectory) -import System.FSNotify (Event(Modified), isPollingManager, watchDir, withManager) +import System.FSNotify (Event(Modified), watchDir, withManager, EventIsDirectory (IsFile)) import Brick hiding (bsDraw) import qualified Brick.BChan as BC @@ -201,7 +201,6 @@ runBrickUi uopts0@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=_iopts,reportspec_=r -- with Debounce at the default 1ms it clears transient errors itself -- but gets tied up for ages withManager $ \mgr -> do - dbg1IO "fsnotify using polling ?" $ isPollingManager mgr files <- mapM (canonicalizePath . fst) $ jfiles j let directories = nubSort $ map takeDirectory files dbg1IO "files" files @@ -212,7 +211,7 @@ runBrickUi uopts0@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=_iopts,reportspec_=r d -- predicate: ignore changes not involving our files (\case - Modified f _ False -> f `elem` files + Modified f _ IsFile -> f `elem` files -- Added f _ -> f `elem` files -- Removed f _ -> f `elem` files -- we don't handle adding/removing journal files right now diff --git a/hledger-ui/package.yaml b/hledger-ui/package.yaml index e6c716553..69e3c9777 100644 --- a/hledger-ui/package.yaml +++ b/hledger-ui/package.yaml @@ -62,7 +62,7 @@ dependencies: - doclayout >=0.3 && <0.5 - extra >=1.6.3 - filepath -- fsnotify >=0.2.1.2 && <0.4 +- fsnotify >=0.4 && <0.5 - microlens >=0.4 - microlens-platform >=0.2.3.1 - megaparsec >=7.0.0 && <9.3 diff --git a/stack.yaml b/stack.yaml index 1d4444e78..0995c3fa6 100644 --- a/stack.yaml +++ b/stack.yaml @@ -14,6 +14,7 @@ extra-deps: # for hledger: # for hledger-ui: - brick-1.0 +- fsnotify-0.4.0.0 # for hledger-web: # for Shake.hs: diff --git a/stack8.10.yaml b/stack8.10.yaml index 79793e977..1f44825bb 100644 --- a/stack8.10.yaml +++ b/stack8.10.yaml @@ -20,6 +20,7 @@ extra-deps: # for hledger-ui: - brick-1.0 - bimap-0.5.0 +- fsnotify-0.4.0.0 - text-zipper-0.12 - vty-5.36 # for hledger-web: diff --git a/stack9.0.yaml b/stack9.0.yaml index 9af032a4d..9df878e46 100644 --- a/stack9.0.yaml +++ b/stack9.0.yaml @@ -23,6 +23,7 @@ extra-deps: # for hledger-ui: - brick-1.0 - bimap-0.5.0 +- fsnotify-0.4.0.0 - text-zipper-0.12 - vty-5.36 # for hledger-web: