brick 0.5 → 0.5.1
raw patch · 6 files changed
+27/−9 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Brick.Widgets.Dialog: dialogButtonsL :: Lens (Dialog a_aUvO) (Dialog a_aUwj) [(String, a_aUvO)] [(String, a_aUwj)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_aZ5Y a_aZ6C. Lens (Dialog a_aZ5Y) (Dialog a_aZ6C) [(String, a_aZ5Y)] [(String, a_aZ6C)]
- Brick.Widgets.Dialog: dialogNameL :: Lens' (Dialog a_aUvO) Name
+ Brick.Widgets.Dialog: dialogNameL :: forall a_aZ5Y. Lens' (Dialog a_aZ5Y) Name
- Brick.Widgets.Dialog: dialogSelectedIndexL :: Lens' (Dialog a_aUvO) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_aZ5Y. Lens' (Dialog a_aZ5Y) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: Lens' (Dialog a_aUvO) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_aZ5Y. Lens' (Dialog a_aZ5Y) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: Lens' (Dialog a_aUvO) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_aZ5Y. Lens' (Dialog a_aZ5Y) Int
- Brick.Widgets.List: listElementsL :: Lens (List e_a118d) (List e_a11eW) (Vector e_a118d) (Vector e_a11eW)
+ Brick.Widgets.List: listElementsL :: forall e_a12iY e_a12re. Lens (List e_a12iY) (List e_a12re) (Vector e_a12iY) (Vector e_a12re)
- Brick.Widgets.List: listItemHeightL :: Lens' (List e_a118d) Int
+ Brick.Widgets.List: listItemHeightL :: forall e_a12iY. Lens' (List e_a12iY) Int
- Brick.Widgets.List: listNameL :: Lens' (List e_a118d) Name
+ Brick.Widgets.List: listNameL :: forall e_a12iY. Lens' (List e_a12iY) Name
- Brick.Widgets.List: listReplace :: Eq e => Vector e -> Maybe Int -> List e -> List e
+ Brick.Widgets.List: listReplace :: Vector e -> Maybe Int -> List e -> List e
- Brick.Widgets.List: listSelectedL :: Lens' (List e_a118d) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall e_a12iY. Lens' (List e_a12iY) (Maybe Int)
Files
- CHANGELOG.md +10/−0
- README.md +8/−0
- brick.cabal +1/−1
- src/Brick/Widgets/Center.hs +6/−6
- src/Brick/Widgets/Internal.hs +1/−1
- src/Brick/Widgets/List.hs +1/−1
CHANGELOG.md view
@@ -2,6 +2,16 @@ Brick changelog --------------- +0.5.1+-----++Bug fixes:+ * Fix negative cropping in hCenter, vCenter, and cropResultToContext+ (fixes #52)+ * Remove unnecessary Eq constraint from listReplace (fixes #48; thanks+ sifmelcara)+ * Mention Google Group in README+ 0.5 ---
README.md view
@@ -65,6 +65,14 @@ To get started, see the [first few sections of the brick user guide](docs/guide.rst). +Brick-Users Discussion+----------------------++The `brick-users` Google Group / e-mail list is a place to discuss+library changes, give feedback, and ask questions. You can subscribe at:++[https://groups.google.com/group/brick-users](https://groups.google.com/group/brick-users)+ Documentation -------------
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.5+version: 0.5.1 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an
src/Brick/Widgets/Center.hs view
@@ -37,9 +37,9 @@ c <- getContext let rWidth = result^.imageL.to imageWidth rHeight = result^.imageL.to imageHeight- remainder = c^.availWidthL - (leftPaddingAmount * 2)- leftPaddingAmount = (c^.availWidthL - rWidth) `div` 2- rightPaddingAmount = leftPaddingAmount + remainder+ remainder = max 0 $ c^.availWidthL - (leftPaddingAmount * 2)+ leftPaddingAmount = max 0 $ (c^.availWidthL - rWidth) `div` 2+ rightPaddingAmount = max 0 $ leftPaddingAmount + remainder leftPadding = charFill (c^.attrL) ch leftPaddingAmount rHeight rightPadding = charFill (c^.attrL) ch rightPaddingAmount rHeight paddedImage = horizCat [ leftPadding@@ -67,9 +67,9 @@ c <- getContext let rWidth = result^.imageL.to imageWidth rHeight = result^.imageL.to imageHeight- remainder = c^.availHeightL - (topPaddingAmount * 2)- topPaddingAmount = (c^.availHeightL - rHeight) `div` 2- bottomPaddingAmount = topPaddingAmount + remainder+ remainder = max 0 $ c^.availHeightL - (topPaddingAmount * 2)+ topPaddingAmount = max 0 $ (c^.availHeightL - rHeight) `div` 2+ bottomPaddingAmount = max 0 $ topPaddingAmount + remainder topPadding = charFill (c^.attrL) ch rWidth topPaddingAmount bottomPadding = charFill (c^.attrL) ch rWidth bottomPaddingAmount paddedImage = vertCat [ topPadding
src/Brick/Widgets/Internal.hs view
@@ -42,4 +42,4 @@ cropResultToContext :: Result -> RenderM Result cropResultToContext result = do c <- getContext- return $ result & imageL %~ (V.crop (c^.availWidthL) (c^.availHeightL))+ return $ result & imageL %~ (V.crop (max 0 $ c^.availWidthL) (max 0 $ c^.availHeightL))
src/Brick/Widgets/List.hs view
@@ -193,7 +193,7 @@ -- | Replace the contents of a list with a new set of elements and -- update the new selected index. If the specified selected index (via -- 'Just') is not in the list bounds, zero is used instead.-listReplace :: Eq e => V.Vector e -> Maybe Int -> List e -> List e+listReplace :: V.Vector e -> Maybe Int -> List e -> List e listReplace es idx l = let newSel = clamp 0 (V.length es - 1) <$> idx in l & listSelectedL .~ newSel