diff --git a/app/Main.hs b/app/Main.hs index 4f4de4d..c651578 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -80,7 +80,7 @@ app :: App AppS e () app = App { appDraw = pure . browse , appHandleEvent = eventHandler - , appStartEvent = pure () + , appStartEvent = put =<< liftIO . changeDir =<< get , appAttrMap = attributeMap , appChooseCursor = showFirstCursor } @@ -174,7 +174,7 @@ scroll d s = s { case d of SUp -> (-1) SDown -> 1 - newCursor = max 0 (min (subtract 1 . length $ appSubFiles s) cursor) + newCursor = clamp 0 (subtract 1 . length $ appSubFiles s) cursor maybeNewPath = fst <$> appSubFiles s !? newCursor eventHandler :: BrickEvent () e -> EventM () AppS () @@ -219,6 +219,5 @@ main :: IO () main = do a <- getWorkingDirectory b <- newIORef =<< empty - c <- changeDir $ initialState a b - _ <- defaultMain app c + _ <- defaultMain app $ initialState a b return ()