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 { 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 ()