brick 0.52 → 0.52.1
raw patch · 5 files changed
+59/−39 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Brick.BorderMap: eBottomL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.BorderMap: eBottomL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.BorderMap: eLeftL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.BorderMap: eLeftL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.BorderMap: eRightL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.BorderMap: eRightL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.BorderMap: eTopL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.BorderMap: eTopL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.Types: bordersL :: forall n_aGxH. Lens' (Result n_aGxH) (BorderMap DynBorder)
+ Brick.Types: bordersL :: forall n_aGK9. Lens' (Result n_aGK9) (BorderMap DynBorder)
- Brick.Types: cursorLocationL :: forall n_aFci. Lens' (CursorLocation n_aFci) Location
+ Brick.Types: cursorLocationL :: forall n_aFoK. Lens' (CursorLocation n_aFoK) Location
- Brick.Types: cursorLocationNameL :: forall n_aFci n_aHaT. Lens (CursorLocation n_aFci) (CursorLocation n_aHaT) (Maybe n_aFci) (Maybe n_aHaT)
+ Brick.Types: cursorLocationNameL :: forall n_aFoK n_aHnl. Lens (CursorLocation n_aFoK) (CursorLocation n_aHnl) (Maybe n_aFoK) (Maybe n_aHnl)
- Brick.Types: cursorsL :: forall n_aGxH. Lens' (Result n_aGxH) [CursorLocation n_aGxH]
+ Brick.Types: cursorsL :: forall n_aGK9. Lens' (Result n_aGK9) [CursorLocation n_aGK9]
- Brick.Types: eBottomL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.Types: eBottomL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.Types: eLeftL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.Types: eLeftL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.Types: eRightL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.Types: eRightL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.Types: eTopL :: forall a_ajjr. Lens' (Edges a_ajjr) a_ajjr
+ Brick.Types: eTopL :: forall a_ajBs. Lens' (Edges a_ajBs) a_ajBs
- Brick.Types: extentsL :: forall n_aGxH. Lens' (Result n_aGxH) [Extent n_aGxH]
+ Brick.Types: extentsL :: forall n_aGK9. Lens' (Result n_aGK9) [Extent n_aGK9]
- Brick.Types: imageL :: forall n_aGxH. Lens' (Result n_aGxH) Image
+ Brick.Types: imageL :: forall n_aGK9. Lens' (Result n_aGK9) Image
- Brick.Types: visibilityRequestsL :: forall n_aGxH. Lens' (Result n_aGxH) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_aGK9. Lens' (Result n_aGK9) [VisibilityRequest]
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1hlu a_a1hmb. Lens (Dialog a_a1hlu) (Dialog a_a1hmb) [(String, a_a1hlu)] [(String, a_a1hmb)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1hue a_a1huV. Lens (Dialog a_a1hue) (Dialog a_a1huV) [(String, a_a1hue)] [(String, a_a1huV)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1hlu. Lens' (Dialog a_a1hlu) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1hue. Lens' (Dialog a_a1hue) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1hlu. Lens' (Dialog a_a1hlu) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1hue. Lens' (Dialog a_a1hue) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1hlu. Lens' (Dialog a_a1hlu) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1hue. Lens' (Dialog a_a1hue) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1cfW n_a1cfX t_a1cgG. Lens (Editor t_a1cfW n_a1cfX) (Editor t_a1cgG n_a1cfX) (TextZipper t_a1cfW) (TextZipper t_a1cgG)
+ Brick.Widgets.Edit: editContentsL :: forall t_a1coG n_a1coH t_a1cpq. Lens (Editor t_a1coG n_a1coH) (Editor t_a1cpq n_a1coH) (TextZipper t_a1coG) (TextZipper t_a1cpq)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1rLm. Lens' (FileBrowser n_a1rLm) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1rUL. Lens' (FileBrowser n_a1rUL) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1rLm. Lens' (FileBrowser n_a1rLm) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1rUL. Lens' (FileBrowser n_a1rUL) (FileInfo -> Bool)
- Brick.Widgets.List: listElementsL :: forall n_a1moI t_a1moJ e_a1moK t_a1mDi e_a1mDj. Lens (GenericList n_a1moI t_a1moJ e_a1moK) (GenericList n_a1moI t_a1mDi e_a1mDj) (t_a1moJ e_a1moK) (t_a1mDi e_a1mDj)
+ Brick.Widgets.List: listElementsL :: forall n_a1my7 t_a1my8 e_a1my9 t_a1mMH e_a1mMI. Lens (GenericList n_a1my7 t_a1my8 e_a1my9) (GenericList n_a1my7 t_a1mMH e_a1mMI) (t_a1my8 e_a1my9) (t_a1mMH e_a1mMI)
- Brick.Widgets.List: listItemHeightL :: forall n_a1moI t_a1moJ e_a1moK. Lens' (GenericList n_a1moI t_a1moJ e_a1moK) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1my7 t_a1my8 e_a1my9. Lens' (GenericList n_a1my7 t_a1my8 e_a1my9) Int
- Brick.Widgets.List: listNameL :: forall n_a1moI t_a1moJ e_a1moK n_a1mDk. Lens (GenericList n_a1moI t_a1moJ e_a1moK) (GenericList n_a1mDk t_a1moJ e_a1moK) n_a1moI n_a1mDk
+ Brick.Widgets.List: listNameL :: forall n_a1my7 t_a1my8 e_a1my9 n_a1mMJ. Lens (GenericList n_a1my7 t_a1my8 e_a1my9) (GenericList n_a1mMJ t_a1my8 e_a1my9) n_a1my7 n_a1mMJ
- Brick.Widgets.List: listSelectedL :: forall n_a1moI t_a1moJ e_a1moK. Lens' (GenericList n_a1moI t_a1moJ e_a1moK) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1my7 t_a1my8 e_a1my9. Lens' (GenericList n_a1my7 t_a1my8 e_a1my9) (Maybe Int)
Files
- CHANGELOG.md +9/−0
- brick.cabal +30/−29
- programs/CustomEventDemo.hs +1/−1
- src/Brick/AttrMap.hs +19/−8
- src/Brick/Widgets/Core.hs +0/−1
CHANGELOG.md view
@@ -2,6 +2,15 @@ Brick changelog --------------- +0.52.1+------++Bug fixes:+ * Attribute map lookups now merge styles in addition to merging colors+ (see `eb857e6bb176e119ac76f5e2af475f1b49812088`).+ * `txtWrapWith` now pads in the single-line case (see also+ `926d317c46b19d4e576748891a1702080287aa03`, #234, and #263)+ 0.52 ----
brick.cabal view
@@ -1,9 +1,10 @@ name: brick-version: 0.52+version: 0.52.1 synopsis: A declarative terminal user interface library description:- Write terminal applications painlessly with 'brick'! You write an- event handler and a drawing function and the library does the rest.+ Write terminal user interfaces (TUIs) painlessly with 'brick'! You+ write an event handler and a drawing function and the library does the+ rest. . . > module Main where@@ -80,7 +81,7 @@ library default-language: Haskell2010- ghc-options: -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -Wall -Wcompat -O2 default-extensions: CPP hs-source-dirs: src exposed-modules:@@ -142,7 +143,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 default-extensions: CPP main-is: ReadmeDemo.hs@@ -154,7 +155,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 default-extensions: CPP main-is: FileBrowserDemo.hs@@ -167,7 +168,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 default-extensions: CPP main-is: FormDemo.hs@@ -182,7 +183,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 default-extensions: CPP main-is: TextWrapDemo.hs@@ -195,7 +196,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 default-extensions: CPP main-is: CacheDemo.hs@@ -210,7 +211,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: VisibilityDemo.hs build-depends: base,@@ -224,7 +225,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 default-extensions: CPP main-is: ViewportScrollDemo.hs@@ -238,7 +239,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: DialogDemo.hs build-depends: base,@@ -251,7 +252,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: MouseDemo.hs build-depends: base,@@ -266,7 +267,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: LayerDemo.hs build-depends: base,@@ -280,7 +281,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: SuspendAndResumeDemo.hs build-depends: base,@@ -294,7 +295,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: PaddingDemo.hs build-depends: base,@@ -307,7 +308,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: ThemeDemo.hs build-depends: base,@@ -320,7 +321,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: AttrDemo.hs build-depends: base,@@ -333,7 +334,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: MarkupDemo.hs build-depends: base,@@ -346,7 +347,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: ListDemo.hs build-depends: base,@@ -360,7 +361,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: ListViDemo.hs build-depends: base,@@ -374,7 +375,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: CustomEventDemo.hs build-depends: base,@@ -388,7 +389,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: FillDemo.hs build-depends: base,@@ -401,7 +402,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: HelloWorldDemo.hs build-depends: base,@@ -414,7 +415,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-language: Haskell2010 main-is: EditDemo.hs build-depends: base,@@ -429,7 +430,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-extensions: CPP default-language: Haskell2010 main-is: BorderDemo.hs@@ -443,7 +444,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-extensions: CPP default-language: Haskell2010 main-is: DynamicBorderDemo.hs@@ -457,7 +458,7 @@ if !flag(demos) Buildable: False hs-source-dirs: programs- ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3+ ghc-options: -threaded -Wall -Wcompat -O2 default-extensions: CPP default-language: Haskell2010 main-is: ProgressBarDemo.hs@@ -470,7 +471,7 @@ test-suite brick-tests type: exitcode-stdio-1.0 hs-source-dirs: tests- ghc-options: -Wall -O2+ ghc-options: -Wall -Wcompat -O2 if impl(ghc >= 8) ghc-options: -Wno-orphans default-language: Haskell2010
programs/CustomEventDemo.hs view
@@ -78,7 +78,7 @@ main = do chan <- newBChan 10 - forkIO $ forever $ do+ void $ forkIO $ forever $ do writeBChan chan Counter threadDelay 1000000
src/Brick/AttrMap.hs view
@@ -53,13 +53,14 @@ import qualified Data.Semigroup as Sem import Control.DeepSeq+import Data.Bits ((.|.)) import qualified Data.Map as M import Data.Maybe (catMaybes) import Data.List (inits) import Data.String (IsString(..)) import GHC.Generics (Generic) -import Graphics.Vty (Attr(..), MaybeDefault(..))+import Graphics.Vty (Attr(..), MaybeDefault(..), Style) -- | An attribute name. Attribute names are hierarchical; use 'mappend' -- ('<>') to assemble them. Hierarchy in an attribute name is used to@@ -137,12 +138,16 @@ -- | Look up the specified attribute name in the map. Map lookups -- proceed as follows. If the attribute map is forcing all lookups to a--- specific attribute, that attribute is returned. If the attribute name--- is empty, the map's default attribute is returned. If the attribute--- name is non-empty, very subsequence of names from the specified name--- are used to perform a lookup, and the results are combined as in--- 'mergeWithDefault', with more specific results taking precedence over--- less specific ones.+-- specific attribute, that attribute is returned along with its style+-- settings. If the attribute name is empty, the map's default attribute+-- is returned. If the attribute name is non-empty, every subsequence of+-- names from the specified name are used to perform a lookup and the+-- results are combined as in 'mergeWithDefault', with more specific+-- results taking precedence over less specific ones. As attributes are+-- merged, styles are also merged. If a more specific attribute name+-- introduces a style (underline, say) and a less specific attribute+-- name introduces an additional style (bold, say) then the final result+-- will include both styles. -- -- For example: --@@ -172,7 +177,7 @@ combineAttrs :: Attr -> Attr -> Attr combineAttrs (Attr s1 f1 b1 u1) (Attr s2 f2 b2 u2) =- Attr (s1 `combineMDs` s2)+ Attr (s1 `combineStyles` s2) (f1 `combineMDs` f2) (b1 `combineMDs` b2) (u1 `combineMDs` u2)@@ -181,6 +186,12 @@ combineMDs _ (SetTo v) = SetTo v combineMDs (SetTo v) _ = SetTo v combineMDs _ v = v++combineStyles :: MaybeDefault Style -> MaybeDefault Style -> MaybeDefault Style+combineStyles (SetTo a) (SetTo b) = SetTo $ a .|. b+combineStyles _ (SetTo v) = SetTo v+combineStyles (SetTo v) _ = SetTo v+combineStyles _ v = v -- | Insert a set of attribute mappings to an attribute map. applyAttrMappings :: [(AttrName, Attr)] -> AttrMap -> AttrMap
src/Brick/Widgets/Core.hs view
@@ -283,7 +283,6 @@ | otherwise = l case force theLines of [] -> return emptyResult- [one] -> return $ emptyResult & imageL .~ (V.text' (c^.attrL) one) multiple -> let maxLength = maximum $ safeTextWidth <$> multiple padding = V.charFill (c^.attrL) ' ' (c^.availWidthL - maxLength) (length lineImgs)