brick 0.4 → 0.4.1
raw patch · 3 files changed
+37/−18 lines, 3 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_aHOc) (Dialog a_aHOH) [(String, a_aHOc)] [(String, a_aHOH)]
+ Brick.Widgets.Dialog: dialogButtonsL :: Lens (Dialog a_aI7t) (Dialog a_aI7Y) [(String, a_aI7t)] [(String, a_aI7Y)]
- Brick.Widgets.Dialog: dialogNameL :: Lens' (Dialog a_aHOc) Name
+ Brick.Widgets.Dialog: dialogNameL :: Lens' (Dialog a_aI7t) Name
- Brick.Widgets.Dialog: dialogSelectedIndexL :: Lens' (Dialog a_aHOc) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: Lens' (Dialog a_aI7t) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: Lens' (Dialog a_aHOc) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: Lens' (Dialog a_aI7t) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: Lens' (Dialog a_aHOc) Int
+ Brick.Widgets.Dialog: dialogWidthL :: Lens' (Dialog a_aI7t) Int
- Brick.Widgets.List: listElementsL :: Lens (List e_aMeV) (List e_aMlE) (Vector e_aMeV) (Vector e_aMlE)
+ Brick.Widgets.List: listElementsL :: Lens (List e_aMyc) (List e_aMEV) (Vector e_aMyc) (Vector e_aMEV)
- Brick.Widgets.List: listItemHeightL :: Lens' (List e_aMeV) Int
+ Brick.Widgets.List: listItemHeightL :: Lens' (List e_aMyc) Int
- Brick.Widgets.List: listNameL :: Lens' (List e_aMeV) Name
+ Brick.Widgets.List: listNameL :: Lens' (List e_aMyc) Name
- Brick.Widgets.List: listSelectedL :: Lens' (List e_aMeV) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: Lens' (List e_aMyc) (Maybe Int)
Files
- CHANGELOG.md +16/−0
- brick.cabal +2/−2
- src/Brick/Widgets/Core.hs +19/−16
CHANGELOG.md view
@@ -2,6 +2,22 @@ Brick changelog --------------- +0.4.1+-----++Bug fixes:+* Fixed a bug in the 'visible' combinator: If the size of the visibility+ request was larger than the available space, then the rendering of a+ viewport was toggling between two states, one with aligning on the+ end of the visibility request, and another one aligning on the start.+ This commit fixes it so that a visibility request is always aligned+ on the start if not enough space is available. (thanks Thomas Strobel+ <ts468@cam.ac.uk>)++Behavior changes:+* Honor multiple 'visible' markers in a single viewport with preference+ on the innermost request (thanks Thomas Strobel <ts468@cam.ac.uk>)+ 0.4 ---
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.4+version: 0.4.1 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an@@ -31,7 +31,7 @@ license-file: LICENSE author: Jonathan Daugherty <cygnus@foobox.com> maintainer: Jonathan Daugherty <cygnus@foobox.com>-copyright: (c) Jonathan Daugherty 2015+copyright: (c) Jonathan Daugherty 2015-2016 category: Graphics build-type: Simple cabal-version: >=1.10
src/Brick/Widgets/Core.hs view
@@ -522,8 +522,9 @@ -- 'Brick.Main.EventM' monad provides primitives to scroll viewports -- created by this function if 'visible' is not what you want. ----- If a viewport receives more than one visibility request, only the--- first is honored. If a viewport receives more than one scrolling+-- If a viewport receives more than one visibility request, then the+-- visibility requests are merged with the inner visibility request+-- taking preference. If a viewport receives more than one scrolling -- request from 'Brick.Main.EventM', all are honored in the order in -- which they are received. viewport :: Name@@ -586,12 +587,12 @@ -- state accordingly when (not $ null $ initialResult^.visibilityRequestsL) $ do Just vp <- lift $ gets $ (^.viewportMapL.to (M.lookup vpname))- let rq = head $ initialResult^.visibilityRequestsL- updatedVp = case typ of- Both -> scrollToView Horizontal rq $ scrollToView Vertical rq vp- Horizontal -> scrollToView typ rq vp- Vertical -> scrollToView typ rq vp- lift $ modify (& viewportMapL %~ (M.insert vpname updatedVp))+ let rqs = initialResult^.visibilityRequestsL+ updateVp vp' rq = case typ of+ Both -> scrollToView Horizontal rq $ scrollToView Vertical rq vp'+ Horizontal -> scrollToView typ rq vp'+ Vertical -> scrollToView typ rq vp'+ lift $ modify (& viewportMapL %~ (M.insert vpname $ foldl updateVp vp rqs)) -- If the size of the rendering changes enough to make the -- viewport offsets invalid, reset them@@ -675,11 +676,12 @@ reqEnd = rq^.vrPositionL.rowL + rq^.vrSizeL._2 newVStart :: Int- newVStart = if reqStart < curStart+ newVStart = if reqStart < vStartEndVisible then reqStart- else if reqStart > curEnd || reqEnd > curEnd- then reqEnd - vp^.vpSize._2- else curStart+ else vStartEndVisible+ vStartEndVisible = if reqEnd < curEnd+ then curStart+ else curStart + (reqEnd - curEnd) scrollToView Horizontal rq vp = vp & vpLeft .~ newHStart where curStart = vp^.vpLeft@@ -688,11 +690,12 @@ reqEnd = rq^.vrPositionL.columnL + rq^.vrSizeL._1 newHStart :: Int- newHStart = if reqStart < curStart+ newHStart = if reqStart < hStartEndVisible then reqStart- else if reqStart > curEnd || reqEnd > curEnd- then reqEnd - vp^.vpSize._1- else curStart+ else hStartEndVisible+ hStartEndVisible = if reqEnd < curEnd+ then curStart+ else curStart + (reqEnd - curEnd) -- | Request that the specified widget be made visible when it is -- rendered inside a viewport. This permits widgets (whose sizes and