packages feed

brick 0.22 → 0.23

raw patch · 6 files changed

+34/−23 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Brick.Main: getVtyHandle :: EventM n (Maybe Vty)
+ Brick.Main: getVtyHandle :: EventM n Vty
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a14rS a_a14ss. Lens (Dialog a_a14rS) (Dialog a_a14ss) [(String, a_a14rS)] [(String, a_a14ss)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a14qB a_a14rb. Lens (Dialog a_a14qB) (Dialog a_a14rb) [(String, a_a14qB)] [(String, a_a14rb)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a14rS. Lens' (Dialog a_a14rS) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a14qB. Lens' (Dialog a_a14qB) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a14rS. Lens' (Dialog a_a14rS) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a14qB. Lens' (Dialog a_a14qB) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a14rS. Lens' (Dialog a_a14rS) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a14qB. Lens' (Dialog a_a14qB) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a16d0 n_a16d1 t_a16dC. Lens (Editor t_a16d0 n_a16d1) (Editor t_a16dC n_a16d1) (TextZipper t_a16d0) (TextZipper t_a16dC)
+ Brick.Widgets.Edit: editContentsL :: forall t_a16bJ n_a16bK t_a16cl. Lens (Editor t_a16bJ n_a16bK) (Editor t_a16cl n_a16bK) (TextZipper t_a16bJ) (TextZipper t_a16cl)
- Brick.Widgets.List: listElementsL :: forall n_a180U e_a180V e_a18b9. Lens (List n_a180U e_a180V) (List n_a180U e_a18b9) (Vector e_a180V) (Vector e_a18b9)
+ Brick.Widgets.List: listElementsL :: forall n_a17ZD e_a17ZE e_a189S. Lens (List n_a17ZD e_a17ZE) (List n_a17ZD e_a189S) (Vector e_a17ZE) (Vector e_a189S)
- Brick.Widgets.List: listItemHeightL :: forall n_a180U e_a180V. Lens' (List n_a180U e_a180V) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a17ZD e_a17ZE. Lens' (List n_a17ZD e_a17ZE) Int
- Brick.Widgets.List: listNameL :: forall n_a180U e_a180V n_a18ba. Lens (List n_a180U e_a180V) (List n_a18ba e_a180V) n_a180U n_a18ba
+ Brick.Widgets.List: listNameL :: forall n_a17ZD e_a17ZE n_a189T. Lens (List n_a17ZD e_a17ZE) (List n_a189T e_a17ZE) n_a17ZD n_a189T
- Brick.Widgets.List: listSelectedL :: forall n_a180U e_a180V. Lens' (List n_a180U e_a180V) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a17ZD e_a17ZE. Lens' (List n_a17ZD e_a17ZE) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,18 @@ Brick changelog --------------- +0.23+----++API changes:+ * getVtyHandle: always return a Vty handle rather than Maybe+   (Previously, in appStartEvent you'd get Nothing because Vty had+   not been initialized yet. This made various use cases impossible+   to satisfy because appStartEvent is a natural place to get initial+   terminal state from Vty. This change makes it so that a Vty handle is+   always available, even in appStartEvent.)+ * txtWrapWith: added missing haddock+ 0.22 ---- 
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.22+version:             0.23 synopsis:            A declarative terminal user interface library description:   Write terminal applications painlessly with 'brick'! You write an
docs/guide.rst view
@@ -832,11 +832,9 @@     do      vty <- Brick.Main.getVtyHandle-     case vty of-       Nothing -> return ()-       Just v -> let output = outputIface v-                 in when (supportsMode output BracketedPaste) $-                      liftIO $ setMode output BracketedPaste True+     let output = outputIface vty+     when (supportsMode output BracketedPaste) $+         liftIO $ setMode output BracketedPaste True  Once enabled, paste mode will generate Vty ``EvPaste`` events. These events will give you the entire pasted content as a ``ByteString`` which@@ -855,11 +853,9 @@     do      vty <- Brick.Main.getVtyHandle-     case vty of-       Nothing -> return ()-       Just v -> let output = outputIface vt-                 in when (supportsMode output Mouse) $-                      liftIO $ setMode output Mouse True+     let output = outputIface vty+     when (supportsMode output Mouse) $+       liftIO $ setMode output Mouse True  Bear in mind that some terminals do not support mouse interaction, so use Vty's ``getModeStatus`` to find out whether your terminal will
src/Brick/Main.hs view
@@ -154,7 +154,7 @@ readBrickEvent brickChan userChan = either id AppEvent <$> readBChan2 brickChan userChan  runWithNewVty :: (Ord n)-              => IO Vty+              => Vty               -> BChan (BrickEvent n e)               -> Maybe (BChan e)               -> App s e n@@ -198,20 +198,22 @@            -- ^ The initial application state.            -> IO s customMain buildVty mUserChan app initialAppState = do-    let run rs st brickChan = do-            result <- runWithNewVty buildVty brickChan mUserChan app rs st+    initialVty <- buildVty+    let run vty rs st brickChan = do+            result <- runWithNewVty vty brickChan mUserChan app rs st             case result of                 InternalHalt s -> return s                 InternalSuspendAndResume newRS action -> do                     newAppState <- action-                    run newRS newAppState brickChan+                    newVty <- buildVty+                    run newVty newRS newAppState brickChan          emptyES = ES [] []-        eventRO = EventRO M.empty Nothing mempty+        eventRO = EventRO M.empty initialVty mempty     (st, eState) <- runStateT (runReaderT (runEventM (appStartEvent app initialAppState)) eventRO) emptyES     let initialRS = RS M.empty (esScrollRequests eState) S.empty mempty []     brickChan <- newBChan 20-    run initialRS st brickChan+    run initialVty initialRS st brickChan  supplyVtyEvents :: Vty -> BChan (BrickEvent n e) -> IO () supplyVtyEvents vty chan =@@ -271,7 +273,7 @@         _ -> return (e, firstRS, exts)      let emptyES = ES [] []-        eventRO = EventRO (viewportMap nextRS) (Just vty) nextExts+        eventRO = EventRO (viewportMap nextRS) vty nextExts      (next, eState) <- runStateT (runReaderT (runEventM (appHandleEvent app appState e'))                                 eventRO) emptyES@@ -320,7 +322,7 @@ findClickedExtents_ pos = reverse . filter (clickedExtent pos)  -- | Get the Vty handle currently in use.-getVtyHandle :: EventM n (Maybe Vty)+getVtyHandle :: EventM n Vty getVtyHandle = EventM $ asks eventVtyHandle  -- | Invalidate the rendering cache entry with the specified resource@@ -334,9 +336,8 @@ invalidateCache = EventM $ do     lift $ modify (\s -> s { cacheInvalidateRequests = InvalidateEntire : cacheInvalidateRequests s }) -withVty :: IO Vty -> (Vty -> IO a) -> IO a-withVty buildVty useVty = do-    vty <- buildVty+withVty :: Vty -> (Vty -> IO a) -> IO a+withVty vty useVty = do     useVty vty `finally` shutdown vty  renderApp :: Vty -> App s e n -> s -> RenderState n -> IO (RenderState n, [Extent n])
src/Brick/Types/Internal.hs view
@@ -112,7 +112,7 @@               deriving (Show)  data EventRO n = EventRO { eventViewportMap :: M.Map n Viewport-                         , eventVtyHandle :: Maybe Vty+                         , eventVtyHandle :: Vty                          , latestExtents :: [Extent n]                          } 
src/Brick/Widgets/Core.hs view
@@ -220,6 +220,8 @@ txtWrap :: T.Text -> Widget n txtWrap = txtWrapWith defaultWrapSettings +-- | Make a widget from text, but wrap the words in the input's lines at+-- the available width using the specified wrapping settings. txtWrapWith :: WrapSettings -> T.Text -> Widget n txtWrapWith settings s =     Widget Fixed Fixed $ do