packages feed

brick 0.6.2 → 0.6.3

raw patch · 4 files changed

+27/−5 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Brick.Types: attrL :: Getting r Context Attr
+ Brick.Types: attrL :: forall r. Getting r Context Attr
- Brick.Widgets.Dialog: dialogButtonsL :: Lens (Dialog a_aR4M) (Dialog a_aR5h) [(String, a_aR4M)] [(String, a_aR5h)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_aUhA a_aUie. Lens (Dialog a_aUhA) (Dialog a_aUie) [(String, a_aUhA)] [(String, a_aUie)]
- Brick.Widgets.Dialog: dialogNameL :: Lens' (Dialog a_aR4M) Name
+ Brick.Widgets.Dialog: dialogNameL :: forall a_aUhA. Lens' (Dialog a_aUhA) Name
- Brick.Widgets.Dialog: dialogSelectedIndexL :: Lens' (Dialog a_aR4M) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_aUhA. Lens' (Dialog a_aUhA) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: Lens' (Dialog a_aR4M) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_aUhA. Lens' (Dialog a_aUhA) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: Lens' (Dialog a_aR4M) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_aUhA. Lens' (Dialog a_aUhA) Int
- Brick.Widgets.List: listElementsL :: Lens (List e_aXIl) (List e_aXP4) (Vector e_aXIl) (Vector e_aXP4)
+ Brick.Widgets.List: listElementsL :: forall e_aXtE e_aXBU. Lens (List e_aXtE) (List e_aXBU) (Vector e_aXtE) (Vector e_aXBU)
- Brick.Widgets.List: listItemHeightL :: Lens' (List e_aXIl) Int
+ Brick.Widgets.List: listItemHeightL :: forall e_aXtE. Lens' (List e_aXtE) Int
- Brick.Widgets.List: listNameL :: Lens' (List e_aXIl) Name
+ Brick.Widgets.List: listNameL :: forall e_aXtE. Lens' (List e_aXtE) Name
- Brick.Widgets.List: listSelectedL :: Lens' (List e_aXIl) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall e_aXtE. Lens' (List e_aXtE) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,16 @@ Brick changelog --------------- +0.6.3+-----++Bug fixes:+ * List: the list now properly renders when the available height is not+   a multiple of the item height. Previously the list size would+   decrease relative to the available height. Now the list renders+   enough items to fill the space even if the top-most or bottom-most+   item is partially visible, which is the expected behavior.+ 0.6.2 ----- 
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.6.2+version:             0.6.3 synopsis:            A declarative terminal user interface library description:   Write terminal applications painlessly with 'brick'! You write an
programs/EditDemo.hs view
@@ -62,9 +62,6 @@         V.EvKey V.KEsc [] -> M.halt st         V.EvKey (V.KChar '\t') [] -> M.continue $ switchEditors st         V.EvKey V.KBackTab [] -> M.continue $ switchEditors st-        V.EvKey (V.KChar ' ') [] ->-            M.continue st { _edit2 = (E.editor secondEditor (str . unlines) Nothing "hello\nworld")-                          }         _ -> M.continue =<< T.handleEventLensed st (currentEditorL st) ev  initialState :: St
src/Brick/Widgets/List.hs view
@@ -135,7 +135,22 @@              start = max 0 $ idx - numPerHeight + 1             num = min (numPerHeight * 2) (V.length (l^.listElementsL) - start)-            numPerHeight = (c^.availHeightL) `div` (l^.listItemHeightL)++            -- The number of items to show is the available height divided by+            -- the item height...+            initialNumPerHeight = (c^.availHeightL) `div` (l^.listItemHeightL)+            -- ... but if the available height leaves a remainder of+            -- an item height then we need to ensure that we render an+            -- extra item to show a partial item at the top or bottom to+            -- give the expected result when an item is more than one+            -- row high. (Example: 5 rows available with item height+            -- of 3 yields two items: one fully rendered, the other+            -- rendered with only its top 2 or bottom 2 rows visible,+            -- depending on how the viewport state changes.)+            numPerHeight = initialNumPerHeight ++                           if initialNumPerHeight * (l^.listItemHeightL) == c^.availHeightL+                           then 0+                           else 1              off = start * (l^.listItemHeightL)