A bit more clean

This commit is contained in:
pingu 2023-10-17 14:09:29 +02:00
parent 262413cc69
commit 787222d067

View File

@ -80,7 +80,7 @@ app :: App AppS e ()
app = app =
App { appDraw = pure . browse App { appDraw = pure . browse
, appHandleEvent = eventHandler , appHandleEvent = eventHandler
, appStartEvent = pure () , appStartEvent = put =<< liftIO . changeDir =<< get
, appAttrMap = attributeMap , appAttrMap = attributeMap
, appChooseCursor = showFirstCursor , appChooseCursor = showFirstCursor
} }
@ -174,7 +174,7 @@ scroll d s = s {
case d of case d of
SUp -> (-1) SUp -> (-1)
SDown -> 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 maybeNewPath = fst <$> appSubFiles s !? newCursor
eventHandler :: BrickEvent () e -> EventM () AppS () eventHandler :: BrickEvent () e -> EventM () AppS ()
@ -219,6 +219,5 @@ main :: IO ()
main = do main = do
a <- getWorkingDirectory a <- getWorkingDirectory
b <- newIORef =<< empty b <- newIORef =<< empty
c <- changeDir $ initialState a b _ <- defaultMain app $ initialState a b
_ <- defaultMain app c
return () return ()