brick 0.15 → 0.15.1
raw patch · 3 files changed
+11/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- brick.cabal +1/−1
- src/Brick/Widgets/List.hs +4/−3
CHANGELOG.md view
@@ -2,6 +2,12 @@ Brick changelog --------------- +0.15.1+------++Bug fixes:+* List: fixed empty list validation in listReplace (thanks Joshua Chia)+ 0.15 ----
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.15+version: 0.15.1 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an
src/Brick/Widgets/List.hs view
@@ -229,11 +229,12 @@ & listElementsL .~ es' -- | 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.+-- update the new selected index. If the list is empty, empty selection is used+-- instead. Otherwise, if the specified selected index (via 'Just') is not in+-- the list bounds, zero is used instead. listReplace :: V.Vector e -> Maybe Int -> List n e -> List n e listReplace es idx l =- let newSel = clamp 0 (V.length es - 1) <$> idx+ let newSel = if V.null es then Nothing else clamp 0 (V.length es - 1) <$> idx in l & listSelectedL .~ newSel & listElementsL .~ es