packages feed

brick 1.2 → 1.3

raw patch · 3 files changed

+25/−21 lines, 3 filesdep −dlistPVP ok

version bump matches the API change (PVP)

Dependencies removed: dlist

API changes (from Hackage documentation)

- Brick.BorderMap: eBottomL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.BorderMap: eBottomL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.BorderMap: eLeftL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.BorderMap: eLeftL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.BorderMap: eRightL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.BorderMap: eRightL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.BorderMap: eTopL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.BorderMap: eTopL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.Types: availHeightL :: forall n_azeL. Lens' (Context n_azeL) Int
+ Brick.Types: availHeightL :: forall n_azeb. Lens' (Context n_azeb) Int
- Brick.Types: availWidthL :: forall n_azeL. Lens' (Context n_azeL) Int
+ Brick.Types: availWidthL :: forall n_azeb. Lens' (Context n_azeb) Int
- Brick.Types: bordersL :: forall n_azeP. Lens' (Result n_azeP) (BorderMap DynBorder)
+ Brick.Types: bordersL :: forall n_azef. Lens' (Result n_azef) (BorderMap DynBorder)
- Brick.Types: ctxAttrMapL :: forall n_azeL. Lens' (Context n_azeL) AttrMap
+ Brick.Types: ctxAttrMapL :: forall n_azeb. Lens' (Context n_azeb) AttrMap
- Brick.Types: ctxAttrNameL :: forall n_azeL. Lens' (Context n_azeL) AttrName
+ Brick.Types: ctxAttrNameL :: forall n_azeb. Lens' (Context n_azeb) AttrName
- Brick.Types: ctxBorderStyleL :: forall n_azeL. Lens' (Context n_azeL) BorderStyle
+ Brick.Types: ctxBorderStyleL :: forall n_azeb. Lens' (Context n_azeb) BorderStyle
- Brick.Types: ctxDynBordersL :: forall n_azeL. Lens' (Context n_azeL) Bool
+ Brick.Types: ctxDynBordersL :: forall n_azeb. Lens' (Context n_azeb) Bool
- Brick.Types: ctxHScrollBarOrientationL :: forall n_azeL. Lens' (Context n_azeL) (Maybe HScrollBarOrientation)
+ Brick.Types: ctxHScrollBarOrientationL :: forall n_azeb. Lens' (Context n_azeb) (Maybe HScrollBarOrientation)
- Brick.Types: ctxHScrollBarRendererL :: forall n_azeL. Lens' (Context n_azeL) (Maybe (ScrollbarRenderer n_azeL))
+ Brick.Types: ctxHScrollBarRendererL :: forall n_azeb. Lens' (Context n_azeb) (Maybe (ScrollbarRenderer n_azeb))
- Brick.Types: ctxVScrollBarOrientationL :: forall n_azeL. Lens' (Context n_azeL) (Maybe VScrollBarOrientation)
+ Brick.Types: ctxVScrollBarOrientationL :: forall n_azeb. Lens' (Context n_azeb) (Maybe VScrollBarOrientation)
- Brick.Types: ctxVScrollBarRendererL :: forall n_azeL. Lens' (Context n_azeL) (Maybe (ScrollbarRenderer n_azeL))
+ Brick.Types: ctxVScrollBarRendererL :: forall n_azeb. Lens' (Context n_azeb) (Maybe (ScrollbarRenderer n_azeb))
- Brick.Types: cursorLocationL :: forall n_azeQ. Lens' (CursorLocation n_azeQ) Location
+ Brick.Types: cursorLocationL :: forall n_azeg. Lens' (CursorLocation n_azeg) Location
- Brick.Types: cursorLocationNameL :: forall n_azeQ n_aBEH. Lens (CursorLocation n_azeQ) (CursorLocation n_aBEH) (Maybe n_azeQ) (Maybe n_aBEH)
+ Brick.Types: cursorLocationNameL :: forall n_azeg n_aBE7. Lens (CursorLocation n_azeg) (CursorLocation n_aBE7) (Maybe n_azeg) (Maybe n_aBE7)
- Brick.Types: cursorsL :: forall n_azeP. Lens' (Result n_azeP) [CursorLocation n_azeP]
+ Brick.Types: cursorsL :: forall n_azef. Lens' (Result n_azef) [CursorLocation n_azef]
- Brick.Types: eBottomL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.Types: eBottomL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.Types: eLeftL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.Types: eLeftL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.Types: eRightL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.Types: eRightL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.Types: eTopL :: forall a_aeJj. Lens' (Edges a_aeJj) a_aeJj
+ Brick.Types: eTopL :: forall a_aeIJ. Lens' (Edges a_aeIJ) a_aeIJ
- Brick.Types: extentsL :: forall n_azeP. Lens' (Result n_azeP) [Extent n_azeP]
+ Brick.Types: extentsL :: forall n_azef. Lens' (Result n_azef) [Extent n_azef]
- Brick.Types: imageL :: forall n_azeP. Lens' (Result n_azeP) Image
+ Brick.Types: imageL :: forall n_azef. Lens' (Result n_azef) Image
- Brick.Types: visibilityRequestsL :: forall n_azeP. Lens' (Result n_azeP) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_azef. Lens' (Result n_azef) [VisibilityRequest]
- Brick.Types: windowHeightL :: forall n_azeL. Lens' (Context n_azeL) Int
+ Brick.Types: windowHeightL :: forall n_azeb. Lens' (Context n_azeb) Int
- Brick.Types: windowWidthL :: forall n_azeL. Lens' (Context n_azeL) Int
+ Brick.Types: windowWidthL :: forall n_azeb. Lens' (Context n_azeb) Int
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1kw7 a_a1kwL. Lens (Dialog a_a1kw7) (Dialog a_a1kwL) [(String, a_a1kw7)] [(String, a_a1kwL)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1kuk a_a1kuY. Lens (Dialog a_a1kuk) (Dialog a_a1kuY) [(String, a_a1kuk)] [(String, a_a1kuY)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1kw7. Lens' (Dialog a_a1kw7) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1kuk. Lens' (Dialog a_a1kuk) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1kw7. Lens' (Dialog a_a1kw7) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1kuk. Lens' (Dialog a_a1kuk) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1kw7. Lens' (Dialog a_a1kw7) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1kuk. Lens' (Dialog a_a1kuk) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1enE n_a1enF t_a1eoj. Lens (Editor t_a1enE n_a1enF) (Editor t_a1eoj n_a1enF) (TextZipper t_a1enE) (TextZipper t_a1eoj)
+ Brick.Widgets.Edit: editContentsL :: forall t_a1elU n_a1elV t_a1emz. Lens (Editor t_a1elU n_a1elV) (Editor t_a1emz n_a1elV) (TextZipper t_a1elU) (TextZipper t_a1emz)
- Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) (List n_a1w47 FileInfo)
+ Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) (List n_a1w2j FileInfo)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) (Maybe IOException)
+ Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) (Maybe IOException)
- Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) [FileInfo]
+ Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) [FileInfo]
- Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) n_a1w47
+ Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) n_a1w2j
- Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) (Maybe Text)
+ Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) (Maybe Text)
- Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1w47. Lens' (FileBrowser n_a1w47) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1w2j. Lens' (FileBrowser n_a1w2j) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) (Set String)
+ Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) (Set String)
- Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1w47. SimpleGetter (FileBrowser n_a1w47) FilePath
+ Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1w2j. SimpleGetter (FileBrowser n_a1w2j) FilePath
- Brick.Widgets.List: listElementsL :: forall n_a1qxt t_a1qxu e_a1qxv t_a1qMG e_a1qMH. Lens (GenericList n_a1qxt t_a1qxu e_a1qxv) (GenericList n_a1qxt t_a1qMG e_a1qMH) (t_a1qxu e_a1qxv) (t_a1qMG e_a1qMH)
+ Brick.Widgets.List: listElementsL :: forall n_a1qvG t_a1qvH e_a1qvI t_a1qKS e_a1qKT. Lens (GenericList n_a1qvG t_a1qvH e_a1qvI) (GenericList n_a1qvG t_a1qKS e_a1qKT) (t_a1qvH e_a1qvI) (t_a1qKS e_a1qKT)
- Brick.Widgets.List: listItemHeightL :: forall n_a1qxt t_a1qxu e_a1qxv. Lens' (GenericList n_a1qxt t_a1qxu e_a1qxv) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1qvG t_a1qvH e_a1qvI. Lens' (GenericList n_a1qvG t_a1qvH e_a1qvI) Int
- Brick.Widgets.List: listNameL :: forall n_a1qxt t_a1qxu e_a1qxv n_a1qMI. Lens (GenericList n_a1qxt t_a1qxu e_a1qxv) (GenericList n_a1qMI t_a1qxu e_a1qxv) n_a1qxt n_a1qMI
+ Brick.Widgets.List: listNameL :: forall n_a1qvG t_a1qvH e_a1qvI n_a1qKU. Lens (GenericList n_a1qvG t_a1qvH e_a1qvI) (GenericList n_a1qKU t_a1qvH e_a1qvI) n_a1qvG n_a1qKU
- Brick.Widgets.List: listSelectedL :: forall n_a1qxt t_a1qxu e_a1qxv. Lens' (GenericList n_a1qxt t_a1qxu e_a1qxv) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1qvG t_a1qvH e_a1qvI. Lens' (GenericList n_a1qvG t_a1qvH e_a1qvI) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,15 @@ Brick changelog --------------- +1.3+---++Package changes:+* Removed dependency on `dlist`.++Performance improvements:+* Improved the performance of `vBox` and `hBox` (thanks Fraser Tweedale)+ 1.2 --- 
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             1.2+version:             1.3 synopsis:            A declarative terminal user interface library description:   Write terminal user interfaces (TUIs) painlessly with 'brick'! You@@ -123,7 +123,6 @@                        bimap >= 0.5 && < 0.6,                        data-clist >= 0.1,                        directory >= 1.2.5.0,-                       dlist,                        exceptions >= 0.10.0,                        filepath,                        containers >= 0.5.7,
src/Brick/Widgets/Core.hs view
@@ -125,8 +125,8 @@ import Control.Monad.State.Strict import Control.Monad.Reader import qualified Data.Foldable as F+import Data.Traversable (for) import qualified Data.Text as T-import qualified Data.DList as DL import qualified Data.Map as M import qualified Data.Set as S import qualified Data.IMap as I@@ -642,30 +642,27 @@       let availPrimary = c^.(contextPrimary br)           availSecondary = c^.(contextSecondary br) -          renderHis _ prev [] = return $ DL.toList prev-          renderHis remainingPrimary prev ((i, prim):rest) = do-              result <- render $ limitPrimary br remainingPrimary-                               $ limitSecondary br availSecondary-                               $ cropToContext prim-              renderHis (remainingPrimary - (result^.imageL.(to $ imagePrimary br)))-                        (DL.snoc prev (i, result)) rest+          renderHi prim = do+            remainingPrimary <- get+            result <- lift $ render $ limitPrimary br remainingPrimary+                                    $ limitSecondary br availSecondary+                                    $ cropToContext prim+            result <$ (put $! remainingPrimary - (result^.imageL.(to $ imagePrimary br))) -      renderedHis <- renderHis availPrimary DL.empty his+      (renderedHis, remainingPrimary) <-+        runStateT (traverse (traverse renderHi) his) availPrimary        renderedLows <- case lows of           [] -> return []           ls -> do-              let remainingPrimary = c^.(contextPrimary br) --                                     (sum $ (^._2.imageL.(to $ imagePrimary br)) <$> renderedHis)-                  primaryPerLow = remainingPrimary `div` length ls+              let primaryPerLow = remainingPrimary `div` length ls                   rest = remainingPrimary - (primaryPerLow * length ls)-                  secondaryPerLow = c^.(contextSecondary br)                   primaries = replicate rest (primaryPerLow + 1) <>                               replicate (length ls - rest) primaryPerLow                let renderLow ((i, prim), pri) =                       (i,) <$> (render $ limitPrimary br pri-                                       $ limitSecondary br secondaryPerLow+                                       $ limitSecondary br availSecondary                                        $ cropToContext prim)                if remainingPrimary > 0 then mapM renderLow (zip ls primaries) else return []@@ -673,11 +670,10 @@       let rendered = sortBy (compare `DF.on` fst) $ renderedHis ++ renderedLows           allResults = snd <$> rendered           allImages = (^.imageL) <$> allResults-          allPrimaries = imagePrimary br <$> allImages-          allTranslatedResults = (flip map) (zip [0..] allResults) $ \(i, result) ->-              let off = locationFromOffset br offPrimary-                  offPrimary = sum $ take i allPrimaries-              in addResultOffset off result+          allTranslatedResults = flip evalState 0 $ for allResults $ \result -> do+              offPrimary <- get+              put $ offPrimary + (result ^. imageL . to (imagePrimary br))+              pure $ addResultOffset (locationFromOffset br offPrimary) result           -- Determine the secondary dimension value to pad to. In a           -- vertical box we want all images to be the same width to           -- avoid attribute over-runs or blank spaces with the wrong