brick 1.10 → 2.0
raw patch · 10 files changed
+65/−18 lines, 10 filesdep +unix-compatdep +vty-crossplatformdep −unixdep ~basedep ~deepseqdep ~vtyPVP ok
version bump matches the API change (PVP)
Dependencies added: unix-compat, vty-crossplatform
Dependencies removed: unix
Dependency ranges changed: base, deepseq, vty
API changes (from Hackage documentation)
- Brick.BorderMap: eBottomL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.BorderMap: eBottomL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.BorderMap: eLeftL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.BorderMap: eLeftL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.BorderMap: eRightL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.BorderMap: eRightL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.BorderMap: eTopL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.BorderMap: eTopL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.Types: availHeightL :: forall n_aztr. Lens' (Context n_aztr) Int
+ Brick.Types: availHeightL :: forall n_azaX. Lens' (Context n_azaX) Int
- Brick.Types: availWidthL :: forall n_aztr. Lens' (Context n_aztr) Int
+ Brick.Types: availWidthL :: forall n_azaX. Lens' (Context n_azaX) Int
- Brick.Types: bordersL :: forall n_aztv. Lens' (Result n_aztv) (BorderMap DynBorder)
+ Brick.Types: bordersL :: forall n_azb1. Lens' (Result n_azb1) (BorderMap DynBorder)
- Brick.Types: ctxAttrMapL :: forall n_aztr. Lens' (Context n_aztr) AttrMap
+ Brick.Types: ctxAttrMapL :: forall n_azaX. Lens' (Context n_azaX) AttrMap
- Brick.Types: ctxAttrNameL :: forall n_aztr. Lens' (Context n_aztr) AttrName
+ Brick.Types: ctxAttrNameL :: forall n_azaX. Lens' (Context n_azaX) AttrName
- Brick.Types: ctxBorderStyleL :: forall n_aztr. Lens' (Context n_aztr) BorderStyle
+ Brick.Types: ctxBorderStyleL :: forall n_azaX. Lens' (Context n_azaX) BorderStyle
- Brick.Types: ctxDynBordersL :: forall n_aztr. Lens' (Context n_aztr) Bool
+ Brick.Types: ctxDynBordersL :: forall n_azaX. Lens' (Context n_azaX) Bool
- Brick.Types: ctxHScrollBarOrientationL :: forall n_aztr. Lens' (Context n_aztr) (Maybe HScrollBarOrientation)
+ Brick.Types: ctxHScrollBarOrientationL :: forall n_azaX. Lens' (Context n_azaX) (Maybe HScrollBarOrientation)
- Brick.Types: ctxHScrollBarRendererL :: forall n_aztr. Lens' (Context n_aztr) (Maybe (HScrollbarRenderer n_aztr))
+ Brick.Types: ctxHScrollBarRendererL :: forall n_azaX. Lens' (Context n_azaX) (Maybe (HScrollbarRenderer n_azaX))
- Brick.Types: ctxVScrollBarOrientationL :: forall n_aztr. Lens' (Context n_aztr) (Maybe VScrollBarOrientation)
+ Brick.Types: ctxVScrollBarOrientationL :: forall n_azaX. Lens' (Context n_azaX) (Maybe VScrollBarOrientation)
- Brick.Types: ctxVScrollBarRendererL :: forall n_aztr. Lens' (Context n_aztr) (Maybe (VScrollbarRenderer n_aztr))
+ Brick.Types: ctxVScrollBarRendererL :: forall n_azaX. Lens' (Context n_azaX) (Maybe (VScrollbarRenderer n_azaX))
- Brick.Types: cursorLocationL :: forall n_aztw. Lens' (CursorLocation n_aztw) Location
+ Brick.Types: cursorLocationL :: forall n_azb2. Lens' (CursorLocation n_azb2) Location
- Brick.Types: cursorLocationNameL :: forall n_aztw n_aBTY. Lens (CursorLocation n_aztw) (CursorLocation n_aBTY) (Maybe n_aztw) (Maybe n_aBTY)
+ Brick.Types: cursorLocationNameL :: forall n_azb2 n_aBBt. Lens (CursorLocation n_azb2) (CursorLocation n_aBBt) (Maybe n_azb2) (Maybe n_aBBt)
- Brick.Types: cursorsL :: forall n_aztv. Lens' (Result n_aztv) [CursorLocation n_aztv]
+ Brick.Types: cursorsL :: forall n_azb1. Lens' (Result n_azb1) [CursorLocation n_azb1]
- Brick.Types: eBottomL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.Types: eBottomL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.Types: eLeftL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.Types: eLeftL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.Types: eRightL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.Types: eRightL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.Types: eTopL :: forall a_aeXR. Lens' (Edges a_aeXR) a_aeXR
+ Brick.Types: eTopL :: forall a_aeFw. Lens' (Edges a_aeFw) a_aeFw
- Brick.Types: extentsL :: forall n_aztv. Lens' (Result n_aztv) [Extent n_aztv]
+ Brick.Types: extentsL :: forall n_azb1. Lens' (Result n_azb1) [Extent n_azb1]
- Brick.Types: imageL :: forall n_aztv. Lens' (Result n_aztv) Image
+ Brick.Types: imageL :: forall n_azb1. Lens' (Result n_azb1) Image
- Brick.Types: visibilityRequestsL :: forall n_aztv. Lens' (Result n_aztv) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_azb1. Lens' (Result n_azb1) [VisibilityRequest]
- Brick.Types: windowHeightL :: forall n_aztr. Lens' (Context n_aztr) Int
+ Brick.Types: windowHeightL :: forall n_azaX. Lens' (Context n_azaX) Int
- Brick.Types: windowWidthL :: forall n_aztr. Lens' (Context n_aztr) Int
+ Brick.Types: windowWidthL :: forall n_azaX. Lens' (Context n_azaX) Int
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1lwP n_a1lwQ a_a1lxD. Lens (Dialog a_a1lwP n_a1lwQ) (Dialog a_a1lxD n_a1lwQ) [(String, n_a1lwQ, a_a1lwP)] [(String, n_a1lwQ, a_a1lxD)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1lef n_a1leg a_a1lf3. Lens (Dialog a_a1lef n_a1leg) (Dialog a_a1lf3 n_a1leg) [(String, n_a1leg, a_a1lef)] [(String, n_a1leg, a_a1lf3)]
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1lwP n_a1lwQ. Lens' (Dialog a_a1lwP n_a1lwQ) (Maybe (Widget n_a1lwQ))
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1lef n_a1leg. Lens' (Dialog a_a1lef n_a1leg) (Maybe (Widget n_a1leg))
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1lwP n_a1lwQ. Lens' (Dialog a_a1lwP n_a1lwQ) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1lef n_a1leg. Lens' (Dialog a_a1lef n_a1leg) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1eP9 n_a1ePa t_a1ePO. Lens (Editor t_a1eP9 n_a1ePa) (Editor t_a1ePO n_a1ePa) (TextZipper t_a1eP9) (TextZipper t_a1ePO)
+ Brick.Widgets.Edit: editContentsL :: forall t_a1ewE n_a1ewF t_a1exj. Lens (Editor t_a1ewE n_a1ewF) (Editor t_a1exj n_a1ewF) (TextZipper t_a1ewE) (TextZipper t_a1exj)
- Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) (List n_a1wGq FileInfo)
+ Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) (List n_a1wth FileInfo)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) (Maybe IOException)
+ Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) (Maybe IOException)
- Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) [FileInfo]
+ Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) [FileInfo]
- Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) n_a1wGq
+ Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) n_a1wth
- Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) (Maybe Text)
+ Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) (Maybe Text)
- Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1wGq. Lens' (FileBrowser n_a1wGq) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1wth. Lens' (FileBrowser n_a1wth) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) (Set String)
+ Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) (Set String)
- Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1wGq. SimpleGetter (FileBrowser n_a1wGq) FilePath
+ Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1wth. SimpleGetter (FileBrowser n_a1wth) FilePath
- Brick.Widgets.List: listElementsL :: forall n_a1r9P t_a1r9Q e_a1r9R t_a1roZ e_a1rp0. Lens (GenericList n_a1r9P t_a1r9Q e_a1r9R) (GenericList n_a1r9P t_a1roZ e_a1rp0) (t_a1r9Q e_a1r9R) (t_a1roZ e_a1rp0)
+ Brick.Widgets.List: listElementsL :: forall n_a1r20 t_a1r21 e_a1r22 t_a1rhe e_a1rhf. Lens (GenericList n_a1r20 t_a1r21 e_a1r22) (GenericList n_a1r20 t_a1rhe e_a1rhf) (t_a1r21 e_a1r22) (t_a1rhe e_a1rhf)
- Brick.Widgets.List: listItemHeightL :: forall n_a1r9P t_a1r9Q e_a1r9R. Lens' (GenericList n_a1r9P t_a1r9Q e_a1r9R) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1r20 t_a1r21 e_a1r22. Lens' (GenericList n_a1r20 t_a1r21 e_a1r22) Int
- Brick.Widgets.List: listNameL :: forall n_a1r9P t_a1r9Q e_a1r9R n_a1rp1. Lens (GenericList n_a1r9P t_a1r9Q e_a1r9R) (GenericList n_a1rp1 t_a1r9Q e_a1r9R) n_a1r9P n_a1rp1
+ Brick.Widgets.List: listNameL :: forall n_a1r20 t_a1r21 e_a1r22 n_a1rhg. Lens (GenericList n_a1r20 t_a1r21 e_a1r22) (GenericList n_a1rhg t_a1r21 e_a1r22) n_a1r20 n_a1rhg
- Brick.Widgets.List: listSelectedL :: forall n_a1r9P t_a1r9Q e_a1r9R. Lens' (GenericList n_a1r9P t_a1r9Q e_a1r9R) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1r20 t_a1r21 e_a1r22. Lens' (GenericList n_a1r20 t_a1r21 e_a1r22) (Maybe Int)
Files
- CHANGELOG.md +15/−0
- README.md +15/−3
- brick.cabal +8/−3
- docs/guide.rst +13/−2
- programs/CustomEventDemo.hs +2/−1
- programs/FormDemo.hs +3/−1
- programs/TailDemo.hs +3/−3
- programs/ViewportScrollbarsDemo.hs +2/−1
- src/Brick/Main.hs +2/−2
- src/Brick/Widgets/FileBrowser.hs +2/−2
CHANGELOG.md view
@@ -2,6 +2,21 @@ Brick changelog --------------- +2.0+---++This release updates Brick to support Vty 6, which includes support for+Windows.++Package changes:+* Increased lower bound on `vty` to 6.0.+* Added dependency on `vty-crossplatform`.+* Migrated from `unix` dependency to `unix-compat`.++Other changes:+* Update core library and demo programs to use `vty-crossplatform` to+ initialize the terminal.+ 1.10 ----
README.md view
@@ -13,7 +13,9 @@ Under the hood, this library builds upon [vty](http://hackage.haskell.org/package/vty), so some knowledge of Vty-will be necessary to use this library.+will be necessary to use this library. Brick depends on+`vty-crossplatform`, so Brick should work anywhere Vty works (Unix and+Windows). Example -------@@ -179,14 +181,24 @@ packages and widgets. If you use that, you'll also be helping to test whether the exported interface is usable and complete! +A note on Windows support+-------------------------++Brick supports Windows implicitly by way of Vty's Windows support.+While I don't (and can't) personally test Brick on Windows hosts,+it should be possible to use Brick on Windows. If you have any+trouble, report any issues here. If needed, we'll migrate them to the+[vty-windows](https://github.com/chhackett/vty-windows) repository if+they need to be fixed there.+ Reporting bugs -------------- Please file bug reports as GitHub issues. For best results: - Include the versions of relevant software packages: your terminal- emulator, `brick`, `ghc`, and `vty` will be the most important- ones.+ emulator, `brick`, `ghc`, `vty`, and Vty platform packages will be+ the most important ones. - Clearly describe the behavior you expected ...
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 1.10+version: 2.0 synopsis: A declarative terminal user interface library description: Write terminal user interfaces (TUIs) painlessly with 'brick'! You@@ -95,7 +95,8 @@ Brick.Widgets.Internal build-depends: base >= 4.9.0.0 && < 4.19.0.0,- vty >= 5.36,+ vty >= 6.0,+ vty-crossplatform, bimap >= 0.5 && < 0.6, data-clist >= 0.1, directory >= 1.2.5.0,@@ -113,7 +114,7 @@ text-zipper >= 0.13, template-haskell, deepseq >= 1.3 && < 1.5,- unix,+ unix-compat, bytestring, word-wrap >= 0.2 @@ -159,6 +160,7 @@ brick, text, vty,+ vty-crossplatform, random, microlens-th, microlens-mtl@@ -202,6 +204,7 @@ text, microlens, microlens-th,+ vty-crossplatform, vty executable brick-text-wrap-demo@@ -259,6 +262,7 @@ build-depends: base, brick, vty,+ vty-crossplatform, text, microlens, microlens-mtl,@@ -449,6 +453,7 @@ build-depends: base, brick, vty,+ vty-crossplatform, text, microlens >= 0.3.0.0, microlens-th,
docs/guide.rst view
@@ -53,6 +53,13 @@ $ cd brick $ cabal new-build +Your package will need some dependencies:++* ``brick``,+* ``vty >= 6.0``, and+* ``vty-crossplatform`` or ``vty-unix`` or ``vty-windows``, depending+ on which platform(s) your application supports.+ Building the Demonstration Programs ----------------------------------- @@ -403,7 +410,7 @@ main :: IO () main = do eventChan <- Brick.BChan.newBChan 10- let buildVty = Graphics.Vty.mkVty Graphics.Vty.defaultConfig+ let buildVty = Graphics.Vty.CrossPlatform.mkVty Graphics.Vty.Config.defaultConfig initialVty <- buildVty finalState <- customMain initialVty buildVty (Just eventChan) app initialState@@ -412,7 +419,11 @@ The ``customMain`` function lets us have control over how the ``vty`` library is initialized *and* how ``brick`` gets custom events to give to our event handler. ``customMain`` is the entry point into ``brick`` when-you need to use your own event type as shown here.+you need to use your own event type as shown here. In this example we're+using ``mkVty`` provided by the ``vty-crossplatform`` package, which+provides build-time support for both Unix and Windows. If you prefer,+you can use either the ``vty-unix`` package or the ``vty-windows``+package directly instead if you only want to support one platform. With all of this in place, sending our custom events to the event handler is straightforward:
programs/CustomEventDemo.hs view
@@ -12,6 +12,7 @@ import Data.Monoid #endif import qualified Graphics.Vty as V+import Graphics.Vty.CrossPlatform (mkVty) import Brick.BChan import Brick.Main@@ -82,6 +83,6 @@ writeBChan chan Counter threadDelay 1000000 - let buildVty = V.mkVty V.defaultConfig+ let buildVty = mkVty V.defaultConfig initialVty <- buildVty void $ customMain initialVty buildVty (Just chan) theApp initialState
programs/FormDemo.hs view
@@ -11,6 +11,8 @@ #endif import qualified Graphics.Vty as V+import Graphics.Vty.CrossPlatform (mkVty)+ import Brick import Brick.Forms ( Form@@ -136,7 +138,7 @@ main :: IO () main = do let buildVty = do- v <- V.mkVty =<< V.standardIOConfig+ v <- mkVty V.defaultConfig V.setMode (V.outputIface v) V.Mouse True return v
programs/TailDemo.hs view
@@ -16,6 +16,7 @@ import Brick.BChan import Brick.Widgets.Border import qualified Graphics.Vty as V+import Graphics.Vty.CrossPlatform (mkVty) data AppState = AppState { _textAreaHeight :: Int@@ -142,11 +143,10 @@ main :: IO () main = do- cfg <- V.standardIOConfig- vty <- V.mkVty cfg+ vty <- mkVty V.defaultConfig chan <- newBChan 10 -- Run thread to simulate incoming data void $ forkIO $ generateLines chan - void $ customMain vty (V.mkVty cfg) (Just chan) app initialState+ void $ customMain vty (mkVty V.defaultConfig) (Just chan) app initialState
programs/ViewportScrollbarsDemo.hs view
@@ -10,6 +10,7 @@ import Data.Monoid ((<>)) #endif import qualified Graphics.Vty as V+import Graphics.Vty.CrossPlatform (mkVty) import qualified Brick.Types as T import qualified Brick.Main as M@@ -167,7 +168,7 @@ main :: IO () main = do let buildVty = do- v <- V.mkVty =<< V.standardIOConfig+ v <- mkVty V.defaultConfig V.setMode (V.outputIface v) V.Mouse True return v
src/Brick/Main.hs view
@@ -73,11 +73,11 @@ , displayBounds , shutdown , nextEvent- , mkVty- , defaultConfig , restoreInputState , inputIface )+import Graphics.Vty.CrossPlatform (mkVty)+import Graphics.Vty.Config (defaultConfig) import Graphics.Vty.Attributes (defAttr) import Brick.BChan (BChan, newBChan, readBChan, readBChan2, writeBChan)
src/Brick/Widgets/FileBrowser.hs view
@@ -162,8 +162,8 @@ import Lens.Micro.TH (lensRules, generateUpdateableOptics) import qualified Graphics.Vty as Vty import qualified System.Directory as D-import qualified System.Posix.Files as U-import qualified System.Posix.Types as U+import qualified System.PosixCompat.Files as U+import qualified System.PosixCompat.Types as U import qualified System.FilePath as FP import Text.Printf (printf)