brick 0.26.1 → 0.27
raw patch · 6 files changed
+55/−23 lines, 6 filesdep ~basedep ~stmdep ~vtyPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, stm, vty
API changes (from Hackage documentation)
+ Brick.Widgets.Core: hyperlink :: Text -> Widget n -> Widget n
- Brick.Types: cursorLocationL :: forall n_aqfS. Lens' (CursorLocation n_aqfS) Location
+ Brick.Types: cursorLocationL :: forall n_aqmN. Lens' (CursorLocation n_aqmN) Location
- Brick.Types: cursorLocationNameL :: forall n_aqfS n_aqJI. Lens (CursorLocation n_aqfS) (CursorLocation n_aqJI) (Maybe n_aqfS) (Maybe n_aqJI)
+ Brick.Types: cursorLocationNameL :: forall n_aqmN n_aqQD. Lens (CursorLocation n_aqmN) (CursorLocation n_aqQD) (Maybe n_aqmN) (Maybe n_aqQD)
- Brick.Types: cursorsL :: forall n_aqeN. Lens' (Result n_aqeN) [CursorLocation n_aqeN]
+ Brick.Types: cursorsL :: forall n_aqlI. Lens' (Result n_aqlI) [CursorLocation n_aqlI]
- Brick.Types: extentsL :: forall n_aqeN. Lens' (Result n_aqeN) [Extent n_aqeN]
+ Brick.Types: extentsL :: forall n_aqlI. Lens' (Result n_aqlI) [Extent n_aqlI]
- Brick.Types: imageL :: forall n_aqeN. Lens' (Result n_aqeN) Image
+ Brick.Types: imageL :: forall n_aqlI. Lens' (Result n_aqlI) Image
- Brick.Types: visibilityRequestsL :: forall n_aqeN. Lens' (Result n_aqeN) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_aqlI. Lens' (Result n_aqlI) [VisibilityRequest]
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a14zk a_a14zU. Lens (Dialog a_a14zk) (Dialog a_a14zU) [(String, a_a14zk)] [(String, a_a14zU)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a14Q2 a_a14QC. Lens (Dialog a_a14Q2) (Dialog a_a14QC) [(String, a_a14Q2)] [(String, a_a14QC)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a14zk. Lens' (Dialog a_a14zk) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a14Q2. Lens' (Dialog a_a14Q2) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a14zk. Lens' (Dialog a_a14zk) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a14Q2. Lens' (Dialog a_a14Q2) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a14zk. Lens' (Dialog a_a14zk) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a14Q2. Lens' (Dialog a_a14Q2) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a16ku n_a16kv t_a16l6. Lens (Editor t_a16ku n_a16kv) (Editor t_a16l6 n_a16kv) (TextZipper t_a16ku) (TextZipper t_a16l6)
+ Brick.Widgets.Edit: editContentsL :: forall t_a16Bc n_a16Bd t_a16BO. Lens (Editor t_a16Bc n_a16Bd) (Editor t_a16BO n_a16Bd) (TextZipper t_a16Bc) (TextZipper t_a16BO)
- Brick.Widgets.List: listElementsL :: forall n_a188q e_a188r e_a18iF. Lens (List n_a188q e_a188r) (List n_a188q e_a18iF) (Vector e_a188r) (Vector e_a18iF)
+ Brick.Widgets.List: listElementsL :: forall n_a18p8 e_a18p9 e_a18zn. Lens (List n_a18p8 e_a18p9) (List n_a18p8 e_a18zn) (Vector e_a18p9) (Vector e_a18zn)
- Brick.Widgets.List: listItemHeightL :: forall n_a188q e_a188r. Lens' (List n_a188q e_a188r) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a18p8 e_a18p9. Lens' (List n_a18p8 e_a18p9) Int
- Brick.Widgets.List: listNameL :: forall n_a188q e_a188r n_a18iG. Lens (List n_a188q e_a188r) (List n_a18iG e_a188r) n_a188q n_a18iG
+ Brick.Widgets.List: listNameL :: forall n_a18p8 e_a18p9 n_a18zo. Lens (List n_a18p8 e_a18p9) (List n_a18zo e_a18p9) n_a18p8 n_a18zo
- Brick.Widgets.List: listSelectedL :: forall n_a188q e_a188r. Lens' (List n_a188q e_a188r) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a18p8 e_a18p9. Lens' (List n_a18p8 e_a18p9) (Maybe Int)
Files
- CHANGELOG.md +11/−0
- README.md +1/−0
- brick.cabal +20/−20
- programs/AttrDemo.hs +10/−2
- src/Brick/AttrMap.hs +2/−1
- src/Brick/Widgets/Core.hs +11/−0
CHANGELOG.md view
@@ -2,6 +2,17 @@ Brick changelog --------------- +0.27+----++API changes:+ * Brick.Widgets.Core: added `hyperlink` combinator (thanks Getty Ritter+ for hyperlinking support)++Other changes:+ * Updated AttrDemo to show how to use hyperlinking+ * README: Added `herms` to featured projects+ 0.26.1 ------
README.md view
@@ -59,6 +59,7 @@ * `viewprof`, a GHC profile viewer: https://github.com/maoe/viewprof * `tart`, a mouse-driven ASCII art drawing program: https://github.com/jtdaugherty/tart * `silly-joy`, an interpreter for Joy in Haskell: https://github.com/rootmos/silly-joy+ * `herms`, a command-line tool for managing kitchen recipes: https://github.com/jackkiefer/herms Getting Started ---------------
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.26.1+version: 0.27 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an@@ -81,7 +81,7 @@ Brick.Widgets.Internal build-depends: base <= 5,- vty >= 5.15,+ vty >= 5.18.1, transformers, data-clist >= 0.1, dlist,@@ -133,7 +133,7 @@ main-is: CacheDemo.hs build-depends: base, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, microlens-th@@ -147,7 +147,7 @@ main-is: VisibilityDemo.hs build-depends: base, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, microlens-th@@ -162,7 +162,7 @@ main-is: ViewportScrollDemo.hs build-depends: base, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -175,7 +175,7 @@ main-is: DialogDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -188,7 +188,7 @@ main-is: MouseDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, microlens-th,@@ -203,7 +203,7 @@ main-is: LayerDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, microlens-th@@ -217,7 +217,7 @@ main-is: SuspendAndResumeDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, microlens-th@@ -231,7 +231,7 @@ main-is: PaddingDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -244,7 +244,7 @@ main-is: AttrDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -257,7 +257,7 @@ main-is: MarkupDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -270,7 +270,7 @@ main-is: ListDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, vector@@ -284,7 +284,7 @@ main-is: ListViDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, vector@@ -298,7 +298,7 @@ main-is: CustomEventDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens >= 0.3.0.0, microlens-th@@ -312,7 +312,7 @@ main-is: FillDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -325,7 +325,7 @@ main-is: HelloWorldDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -338,7 +338,7 @@ main-is: EditDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, vector, microlens >= 0.3.0.0,@@ -354,7 +354,7 @@ main-is: BorderDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens @@ -368,6 +368,6 @@ main-is: ProgressBarDemo.hs build-depends: base <= 5, brick,- vty >= 5.15,+ vty >= 5.18.1, text, microlens
programs/AttrDemo.hs view
@@ -4,7 +4,7 @@ import Data.Monoid import Graphics.Vty ( Attr, white, blue, cyan, green, red, yellow- , black+ , black, withURL ) import Brick.Main@@ -16,6 +16,7 @@ , withAttr , vBox , str+ , hyperlink ) import Brick.Util (on, fg) import Brick.AttrMap (attrMap, AttrMap)@@ -35,9 +36,15 @@ , withAttr "foundFull" $ str "You can override everything ..." , withAttr "foundFgOnly" $- str "... or only you want to change and inherit the rest."+ str "... or only what you want to change and inherit the rest." , str "Attribute names are assembled with the Monoid append operation to indicate" , str "hierarchy levels, e.g. \"window\" <> \"title\"."+ , str " "+ , withAttr "linked" $+ str "This text is hyperlinked in terminals that support hyperlinking."+ , str " "+ , hyperlink "http://www.google.com/" $+ str "This text is also hyperlinked in terminals that support hyperlinking." ] globalDefault :: Attr@@ -49,6 +56,7 @@ , ("foundFgOnly", fg red) , ("general", yellow `on` black) , ("general" <> "specific", fg cyan)+ , ("linked", fg yellow `withURL` "http://www.google.com/") ] app :: App () e ()
src/Brick/AttrMap.hs view
@@ -150,10 +150,11 @@ setDefault newDefault (AttrMap _ m) = AttrMap newDefault m combineAttrs :: Attr -> Attr -> Attr-combineAttrs (Attr s1 f1 b1) (Attr s2 f2 b2) =+combineAttrs (Attr s1 f1 b1 u1) (Attr s2 f2 b2 u2) = Attr (s1 `combineMDs` s2) (f1 `combineMDs` f2) (b1 `combineMDs` b2)+ (u1 `combineMDs` u2) combineMDs :: MaybeDefault a -> MaybeDefault a -> MaybeDefault a combineMDs _ (SetTo v) = SetTo v
src/Brick/Widgets/Core.hs view
@@ -18,6 +18,7 @@ , strWrap , strWrapWith , fill+ , hyperlink -- * Padding , padLeft@@ -264,6 +265,16 @@ -- when the input contains multiple lines. txt :: T.Text -> Widget n txt = str . T.unpack++-- | Hyperlink the given widget to the specified URL. Not all terminal+-- emulators support this. In those that don't, this should have no+-- discernible effect.+hyperlink :: T.Text -> Widget n -> Widget n+hyperlink url p =+ Widget (hSize p) (vSize p) $ do+ c <- getContext+ let attr = attrMapLookup (c^.ctxAttrNameL) (c^.ctxAttrMapL) `V.withURL` url+ withReaderT (& ctxAttrMapL %~ setDefault attr) (render p) -- | Pad the specified widget on the left. If max padding is used, this -- grows greedily horizontally; otherwise it defers to the padded