packages feed

brick-tabular-list 2.0.0.0 → 2.0.1.0

raw patch · 5 files changed

+22/−16 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Brick.Widgets.TabularList.Types: [$sel:selected:RowHdrCtxt] :: RowHdrCtxt -> Selected

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for brick-tabular-list +## 2.0.1.0 -- 2023-03-14++* Name the single field in `RowHdrCtxt` newtype for semantic correctness.+ ## 2.0.0.0 -- 2023-03-13  * Made it much easier to understand API and implementation
brick-tabular-list.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: brick-tabular-list-version: 2.0.0.0+version: 2.0.1.0  synopsis: Tabular list widgets for brick. 
src/Brick/Widgets/TabularList/Grid.hs view
@@ -260,25 +260,25 @@       colHdrRow vCs (RowHdrW rhw) (WdthD rhwd) = case r ^. #colHdr of         Nothing -> emptyWidget         Just (GridColHdr {draw, height=ColHdrH chh}) -> let-          drawCol wd c (ColW w) = sz (w, chh) $ draw (LstFcs f) wd $ GColC c $ Sel (c == curCol)+          col wd c (ColW w) = sz (w, chh) $ draw (LstFcs f) wd $ GColC c $ Sel (c == curCol)           chrw = case r ^. #colHdrRowHdr of             BlankCHRH -> fill ' '             CHRH dchrw -> dchrw (LstFcs f) (WdthD rhwd)-          in sz (rhw, chh) chrw <+> renderColumns l vCs drawCol (H chh)+          in sz (rhw, chh) chrw <+> renderColumns l vCs col (H chh)       row vCs i f r = let         col wd c (ColW w) = let gc = GrdCtxt (GRowC (Ix i) (Sel f)) $ GColC c $ Sel (c == curCol)           in sz (w, iH) $ cell (LstFcs f) wd gc r         in renderColumns l vCs col (H iH)-      drawList = let vCs = visibleColumns l (AvlW aW) in+      lst = let vCs = visibleColumns l (AvlW aW) in         render $ colHdrRow vCs (RowHdrW 0) (WdthD 0) <=> L.renderListWithIndex (row vCs) f l'-      drawHdrList (RowHdr {draw, width, toRH}) = let-        RowHdrW rhw' = width (AvlW aW) $ uncurry (zipWith toRH) $ visibleRowIdx l' (AvlH aH)+      hdrLst (RowHdr {draw=drw, width, toRH=tR}) = let+        RowHdrW rhw' = width (AvlW aW) $ uncurry (zipWith tR) $ visibleRowIdx l' (AvlH aH)         rhw = min rhw' aW         rhwd = WdthD $ max 0 $ rhw' - aW         vCs = visibleColumns l $ AvlW $ aW - rhw-        hdrRow i f r = sz (rhw, iH) (draw (LstFcs f) rhwd (RowHdrCtxt $ Sel f) $ toRH r (Ix i)) <+> row vCs i f r+        hdrRow i f r = sz (rhw, iH) (drw (LstFcs f) rhwd (RowHdrCtxt $ Sel f) $ tR r (Ix i)) <+> row vCs i f r         in render $ colHdrRow vCs (RowHdrW rhw) rhwd <=> L.renderListWithIndex hdrRow f l'-  maybe drawList drawHdrList $ r ^. #rowHdr+  maybe lst hdrLst $ r ^. #rowHdr  -- | Move to the left by one column. gridMoveLeft
src/Brick/Widgets/TabularList/Mixed.hs view
@@ -138,25 +138,25 @@       colHdrRow wprk (RowHdrW rhw) (WdthD rhwd) = case r ^. #colHdr of         Nothing -> emptyWidget         Just (MixedColHdr {draw, widths, height=ColHdrH chh}) -> let-          drawCol ci (ColW w) = sz (w, chh) $ draw (LstFcs f) (MColC ci)+          col ci (ColW w) = sz (w, chh) $ draw (LstFcs f) (MColC ci)           chrw = case r ^. #colHdrRowHdr of             BlankCHRH -> fill ' '             CHRH chrw -> chrw (LstFcs f) (WdthD rhwd)-          in sz (rhw, chh) chrw <+> hBox (zipWith drawCol [Ix 0..] $ widths wprk)+          in sz (rhw, chh) chrw <+> hBox (zipWith col [Ix 0..] $ widths wprk)       row wprk i f r = let         col ci (ColW w) = sz (w, iH) $ cell (LstFcs f) (MxdCtxt (MRowC (Ix i) (Sel f)) $ MColC ci) r         in hBox $ zipWith col [Ix 0..] $ wpr wprk r-      drawList = let wprk = wprk' (AvlW aW) $ fst $ visibleRowIdx l' (AvlH aH)+      lst = let wprk = wprk' (AvlW aW) $ fst $ visibleRowIdx l' (AvlH aH)         in render $ colHdrRow wprk (RowHdrW 0) (WdthD 0) <=> L.renderListWithIndex (row wprk) f l'-      drawHdrList (RowHdr {draw, width, toRH}) = let+      hdrLst (RowHdr {draw=drw, width, toRH=tR}) = let         (es, is) = visibleRowIdx l' (AvlH aH)-        RowHdrW rhw' = width (AvlW aW) $ zipWith toRH es is+        RowHdrW rhw' = width (AvlW aW) $ zipWith tR es is         rhw = min rhw' aW         rhwd = WdthD $ max 0 $ rhw' - aW         wprk = wprk' (AvlW $ aW - rhw) es-        hdrRow i f r = sz (rhw, iH) (draw (LstFcs f) rhwd (RowHdrCtxt $ Sel f) $ toRH r (Ix i)) <+> row wprk i f r+        hdrRow i f r = sz (rhw, iH) (drw (LstFcs f) rhwd (RowHdrCtxt $ Sel f) $ tR r (Ix i)) <+> row wprk i f r         in render $ colHdrRow wprk (RowHdrW rhw) rhwd <=> L.renderListWithIndex hdrRow f l'-  maybe drawList drawHdrList $ r ^. #rowHdr+  maybe lst hdrLst $ r ^. #rowHdr  -- | Handle events for mixed tabular list with navigation keys. This just calls 'L.handleListEvent'. handleMixedListEvent :: Ord n
src/Brick/Widgets/TabularList/Types.hs view
@@ -75,7 +75,9 @@ newtype Selected = Sel Bool deriving (Eq, Generic, Show)  -- | Row header context-newtype RowHdrCtxt = RowHdrCtxt Selected deriving (Eq, Generic, Show)+newtype RowHdrCtxt = RowHdrCtxt {+  selected :: Selected+} deriving (Eq, Generic, Show)  -- | Row header --