packages feed

brick 0.36 → 0.36.1

raw patch · 5 files changed

+44/−17 lines, 5 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Brick.Widgets.List: listElements :: List n e -> (Vector e)
+ Brick.Widgets.List: listItemHeight :: List n e -> Int
+ Brick.Widgets.List: listName :: List n e -> n
+ Brick.Widgets.List: listSelected :: List n e -> (Maybe Int)
- Brick.Main: invalidateCache :: EventM n ()
+ Brick.Main: invalidateCache :: (Ord n) => EventM n ()
- Brick.Main: invalidateCacheEntry :: n -> EventM n ()
+ Brick.Main: invalidateCacheEntry :: (Ord n) => n -> EventM n ()
- Brick.Types: bordersL :: forall n_aBMP. Lens' (Result n_aBMP) (BorderMap DynBorder)
+ Brick.Types: bordersL :: forall n_aBPo. Lens' (Result n_aBPo) (BorderMap DynBorder)
- Brick.Types: cursorLocationNameL :: forall n_aBdm n_aC8N. Lens (CursorLocation n_aBdm) (CursorLocation n_aC8N) (Maybe n_aBdm) (Maybe n_aC8N)
+ Brick.Types: cursorLocationNameL :: forall n_aBdm n_aCbj. Lens (CursorLocation n_aBdm) (CursorLocation n_aCbj) (Maybe n_aBdm) (Maybe n_aCbj)
- Brick.Types: cursorsL :: forall n_aBMP. Lens' (Result n_aBMP) [CursorLocation n_aBMP]
+ Brick.Types: cursorsL :: forall n_aBPo. Lens' (Result n_aBPo) [CursorLocation n_aBPo]
- Brick.Types: extentsL :: forall n_aBMP. Lens' (Result n_aBMP) [Extent n_aBMP]
+ Brick.Types: extentsL :: forall n_aBPo. Lens' (Result n_aBPo) [Extent n_aBPo]
- Brick.Types: imageL :: forall n_aBMP. Lens' (Result n_aBMP) Image
+ Brick.Types: imageL :: forall n_aBPo. Lens' (Result n_aBPo) Image
- Brick.Types: visibilityRequestsL :: forall n_aBMP. Lens' (Result n_aBMP) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_aBPo. Lens' (Result n_aBPo) [VisibilityRequest]
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a14be a_a14bU. Lens (Dialog a_a14be) (Dialog a_a14bU) [(String, a_a14be)] [(String, a_a14bU)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a14AW a_a14BC. Lens (Dialog a_a14AW) (Dialog a_a14BC) [(String, a_a14AW)] [(String, a_a14BC)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a14be. Lens' (Dialog a_a14be) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a14AW. Lens' (Dialog a_a14AW) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a14be. Lens' (Dialog a_a14be) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a14AW. Lens' (Dialog a_a14AW) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a14be. Lens' (Dialog a_a14be) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a14AW. Lens' (Dialog a_a14AW) Int
- Brick.Widgets.Edit: editContentsL :: forall t_aZHO n_aZHP t_aZIw. Lens (Editor t_aZHO n_aZHP) (Editor t_aZIw n_aZHP) (TextZipper t_aZHO) (TextZipper t_aZIw)
+ Brick.Widgets.Edit: editContentsL :: forall t_a107w n_a107x t_a108e. Lens (Editor t_a107w n_a107x) (Editor t_a108e n_a107x) (TextZipper t_a107w) (TextZipper t_a108e)
- Brick.Widgets.List: listElementsL :: forall n_a18No e_a18Np e_a18XB. Lens (List n_a18No e_a18Np) (List n_a18No e_a18XB) (Vector e_a18Np) (Vector e_a18XB)
+ Brick.Widgets.List: listElementsL :: forall n_a19iL e_a19iM e_a19sY. Lens (List n_a19iL e_a19iM) (List n_a19iL e_a19sY) (Vector e_a19iM) (Vector e_a19sY)
- Brick.Widgets.List: listItemHeightL :: forall n_a18No e_a18Np. Lens' (List n_a18No e_a18Np) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a19iL e_a19iM. Lens' (List n_a19iL e_a19iM) Int
- Brick.Widgets.List: listNameL :: forall n_a18No e_a18Np n_a18XC. Lens (List n_a18No e_a18Np) (List n_a18XC e_a18Np) n_a18No n_a18XC
+ Brick.Widgets.List: listNameL :: forall n_a19iL e_a19iM n_a19sZ. Lens (List n_a19iL e_a19iM) (List n_a19sZ e_a19iM) n_a19iL n_a19sZ
- Brick.Widgets.List: listSelectedL :: forall n_a18No e_a18Np. Lens' (List n_a18No e_a18Np) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a19iL e_a19iM. Lens' (List n_a19iL e_a19iM) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,17 @@ Brick changelog --------------- +0.36.1+------++Package changes:+ * Raiseed upper bound to support GHC 8.4.2 (#171)++Other changes:+ * Improved List accessor documentation (thanks liam <liam@magicseaweed.com>)+ * Brick.Main now uses a Set instead a list to track invalidation+   requests to avoid duplicates.+ 0.36 ---- 
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.36+version:             0.36.1 synopsis:            A declarative terminal user interface library description:   Write terminal applications painlessly with 'brick'! You write an@@ -86,7 +86,7 @@     Brick.Types.Internal     Brick.Widgets.Internal -  build-depends:       base <= 4.11.0.0,+  build-depends:       base <= 4.11.1.0,                        vty >= 5.18.1,                        transformers,                        data-clist >= 0.1,
src/Brick/Main.hs view
@@ -52,6 +52,7 @@ import Control.Applicative ((<$>)) import Data.Monoid (mempty) #endif+import qualified Data.Foldable as F import Data.Maybe (listToMaybe) import qualified Data.Map as M import qualified Data.Set as S@@ -219,7 +220,7 @@                     newVty <- buildVty                     run newVty newRS newAppState brickChan -        emptyES = ES [] []+        emptyES = ES [] mempty         eventRO = EventRO M.empty initialVty mempty     (st, eState) <- runStateT (runReaderT (runEventM (appStartEvent app initialAppState)) eventRO) emptyES     let initialRS = RS M.empty (esScrollRequests eState) S.empty mempty []@@ -293,7 +294,7 @@                 _ -> return (e, firstRS, exts)         _ -> return (e, firstRS, exts) -    let emptyES = ES [] []+    let emptyES = ES [] mempty         eventRO = EventRO (viewportMap nextRS) vty nextExts      (next, eState) <- runStateT (runReaderT (runEventM (appHandleEvent app appState e'))@@ -303,11 +304,14 @@                                          renderCache nextRS                          }) -applyInvalidations :: (Ord n) => [CacheInvalidateRequest n] -> M.Map n v -> M.Map n v-applyInvalidations ns cache = foldr (.) id (mkFunc <$> ns) cache+applyInvalidations :: (Ord n) => S.Set (CacheInvalidateRequest n) -> M.Map n v -> M.Map n v+applyInvalidations ns cache =+    if InvalidateEntire `S.member` ns+    then mempty+    else foldr (.) id (mkFunc <$> F.toList ns) cache     where-    mkFunc InvalidateEntire = const mempty-    mkFunc (InvalidateSingle n) = M.delete n+        mkFunc InvalidateEntire = const mempty+        mkFunc (InvalidateSingle n) = M.delete n  -- | Given a viewport name, get the viewport's size and offset -- information from the most recent rendering. Returns 'Nothing' if@@ -348,14 +352,14 @@  -- | Invalidate the rendering cache entry with the specified resource -- name.-invalidateCacheEntry :: n -> EventM n ()+invalidateCacheEntry :: (Ord n) => n -> EventM n () invalidateCacheEntry n = EventM $ do-    lift $ modify (\s -> s { cacheInvalidateRequests = InvalidateSingle n : cacheInvalidateRequests s })+    lift $ modify (\s -> s { cacheInvalidateRequests = S.insert (InvalidateSingle n) $ cacheInvalidateRequests s })  -- | Invalidate the entire rendering cache.-invalidateCache :: EventM n ()+invalidateCache :: (Ord n) => EventM n () invalidateCache = EventM $ do-    lift $ modify (\s -> s { cacheInvalidateRequests = InvalidateEntire : cacheInvalidateRequests s })+    lift $ modify (\s -> s { cacheInvalidateRequests = S.insert InvalidateEntire $ cacheInvalidateRequests s })  withVty :: Vty -> (Vty -> IO a) -> IO a withVty vty useVty = do
src/Brick/Types/Internal.hs view
@@ -105,11 +105,13 @@                   -- ^ Viewports of this type are scrollable vertically and horizontally.                   deriving (Show, Eq) -data CacheInvalidateRequest n = InvalidateSingle n-                              | InvalidateEntire+data CacheInvalidateRequest n =+    InvalidateSingle n+    | InvalidateEntire+    deriving (Ord, Eq)  data EventState n = ES { esScrollRequests :: [(n, ScrollRequest)]-                       , cacheInvalidateRequests :: [CacheInvalidateRequest n]+                       , cacheInvalidateRequests :: S.Set (CacheInvalidateRequest n)                        }  -- | An extent of a named area: its size, location, and origin.
src/Brick/Widgets/List.hs view
@@ -9,7 +9,7 @@ -- | This module provides a scrollable list type and functions for -- manipulating and rendering it. module Brick.Widgets.List-  ( List(listElements, listSelected, listName, listItemHeight)+  ( List    -- * Constructing a list   , list@@ -27,6 +27,13 @@   , listNameL   , listItemHeightL +  -- * Accessors+  , listElements+  , listName+  , listSelectedElement+  , listSelected+  , listItemHeight+   -- * Manipulating a list   , listMoveBy   , listMoveTo@@ -38,7 +45,6 @@   , listInsert   , listRemove   , listReplace-  , listSelectedElement   , listClear   , listReverse   , listModify@@ -78,9 +84,13 @@ --   list data List n e =     List { listElements :: !(V.Vector e)+         -- ^ The list's vector of elements.          , listSelected :: !(Maybe Int)+         -- ^ The list's selected element index, if any.          , listName :: n+         -- ^ The list's name.          , listItemHeight :: Int+         -- ^ The height of the list items.          } deriving (Functor, Foldable, Traversable, Show)  suffixLenses ''List