brick 0.65 → 0.65.1
raw patch · 7 files changed
+49/−13 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1eDQ a_a1eEu. Lens (Dialog a_a1eDQ) (Dialog a_a1eEu) [(String, a_a1eDQ)] [(String, a_a1eEu)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1eEt a_a1eF7. Lens (Dialog a_a1eEt) (Dialog a_a1eF7) [(String, a_a1eEt)] [(String, a_a1eF7)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1eDQ. Lens' (Dialog a_a1eDQ) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1eEt. Lens' (Dialog a_a1eEt) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1eDQ. Lens' (Dialog a_a1eDQ) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1eEt. Lens' (Dialog a_a1eEt) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1eDQ. Lens' (Dialog a_a1eDQ) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1eEt. Lens' (Dialog a_a1eEt) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a18Ul n_a18Um t_a18V0. Lens (Editor t_a18Ul n_a18Um) (Editor t_a18V0 n_a18Um) (TextZipper t_a18Ul) (TextZipper t_a18V0)
+ Brick.Widgets.Edit: editContentsL :: forall t_a18UY n_a18UZ t_a18VD. Lens (Editor t_a18UY n_a18UZ) (Editor t_a18VD n_a18UZ) (TextZipper t_a18UY) (TextZipper t_a18VD)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1oSl. Lens' (FileBrowser n_a1oSl) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1oSY. Lens' (FileBrowser n_a1oSY) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1oSl. Lens' (FileBrowser n_a1oSl) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1oSY. Lens' (FileBrowser n_a1oSY) (FileInfo -> Bool)
- Brick.Widgets.List: listElementsL :: forall n_a1jGq t_a1jGr e_a1jGs t_a1jUx e_a1jUy. Lens (GenericList n_a1jGq t_a1jGr e_a1jGs) (GenericList n_a1jGq t_a1jUx e_a1jUy) (t_a1jGr e_a1jGs) (t_a1jUx e_a1jUy)
+ Brick.Widgets.List: listElementsL :: forall n_a1jH3 t_a1jH4 e_a1jH5 t_a1jVa e_a1jVb. Lens (GenericList n_a1jH3 t_a1jH4 e_a1jH5) (GenericList n_a1jH3 t_a1jVa e_a1jVb) (t_a1jH4 e_a1jH5) (t_a1jVa e_a1jVb)
- Brick.Widgets.List: listItemHeightL :: forall n_a1jGq t_a1jGr e_a1jGs. Lens' (GenericList n_a1jGq t_a1jGr e_a1jGs) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1jH3 t_a1jH4 e_a1jH5. Lens' (GenericList n_a1jH3 t_a1jH4 e_a1jH5) Int
- Brick.Widgets.List: listNameL :: forall n_a1jGq t_a1jGr e_a1jGs n_a1jUz. Lens (GenericList n_a1jGq t_a1jGr e_a1jGs) (GenericList n_a1jUz t_a1jGr e_a1jGs) n_a1jGq n_a1jUz
+ Brick.Widgets.List: listNameL :: forall n_a1jH3 t_a1jH4 e_a1jH5 n_a1jVc. Lens (GenericList n_a1jH3 t_a1jH4 e_a1jH5) (GenericList n_a1jVc t_a1jH4 e_a1jH5) n_a1jH3 n_a1jVc
- Brick.Widgets.List: listSelectedL :: forall n_a1jGq t_a1jGr e_a1jGs. Lens' (GenericList n_a1jGq t_a1jGr e_a1jGs) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1jH3 t_a1jH4 e_a1jH5. Lens' (GenericList n_a1jH3 t_a1jH4 e_a1jH5) (Maybe Int)
Files
- CHANGELOG.md +10/−0
- brick.cabal +2/−2
- docs/guide.rst +7/−0
- docs/samtay-tutorial.md +1/−1
- src/Brick.hs +7/−4
- src/Brick/Main.hs +9/−1
- src/Brick/Widgets/Core.hs +13/−5
CHANGELOG.md view
@@ -2,6 +2,14 @@ Brick changelog --------------- +0.65.1+------++Bug fixes:+ * `Brick.Widgets.Core.viewport`: fixed non-scroll+ direction width/height in the presence of scroll bars (see+ e41ad936ebe8b49e259a72ff7a34765d5a587aaa).+ 0.65 ---- @@ -38,6 +46,8 @@ * `scrollbarAttr` - the base attribute of scroll bars * `scrollbarTroughAttr` - the attribute of scroll bar troughs * `scrollbarHandleAttr` - the attribute of scroll bar handles+ * The `Context` type got the `n` type argument that is used for+ `Result`, `EventM`, etc. Package changes: * Raised `base` bounds to allow building with GHC 9.2.1 (thanks Mario
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.65+version: 0.65.1 synopsis: A declarative terminal user interface library description: Write terminal user interfaces (TUIs) painlessly with 'brick'! You@@ -32,7 +32,7 @@ license-file: LICENSE author: Jonathan Daugherty <cygnus@foobox.com> maintainer: Jonathan Daugherty <cygnus@foobox.com>-copyright: (c) Jonathan Daugherty 2015-2020+copyright: (c) Jonathan Daugherty 2015-2021 category: Graphics build-type: Simple cabal-version: 1.18
docs/guide.rst view
@@ -1245,6 +1245,13 @@ column of available space if vertical scroll bars are enabled and one row of available space if horizontal scroll bars are enabled. +Scroll bars can also be configured to draw "handles" with+``withHScrollBarHandles`` and ``withVScrollBarHandles``.++Lastly, scroll bars can be configured to report mouse events on+each scroll bar element. To enable mouse click reporting, use+``withClickableHScrollBars`` and ``withClickableVScrollBars``.+ For a demonstration of the scroll bar API in action, see the ``ViewportScrollbarsDemo.hs`` demonstration program.
docs/samtay-tutorial.md view
@@ -24,7 +24,7 @@ 1. [Demo programs](https://github.com/jtdaugherty/brick/tree/master/programs) (clone down to explore the code and run them locally) 2. [User guide](https://github.com/jtdaugherty/brick/blob/master/docs/guide.rst)-3. [Haddock docs](https://hackage.haskell.org/package/brick-0.18)+3. [Haddock docs](https://hackage.haskell.org/package/brick) 4. [Google group](https://groups.google.com/forum/#!forum/brick-users) ### The basic idea
src/Brick.hs view
@@ -1,8 +1,11 @@ -- | This module is provided as a convenience to import the most--- important parts of the API all at once. Note that the Haddock--- documentation for this library is for /reference/ usage; if you--- are looking for an introduction or tutorial, see the README for links--- to plenty of material!+-- important parts of the API all at once. If you are new to Brick and+-- are looking to learn it, the best place to start is the+-- [Brick User Guide](https://github.com/jtdaugherty/brick/blob/master/docs/guide.rst).+-- The README also has links to other learning resources. Unlike+-- most Haskell libraries that only have API documentation, Brick+-- is best larned by reading the User Guide and other materials and+-- referring to the API docs only as needed. Enjoy! module Brick ( module Brick.Main , module Brick.Types
src/Brick/Main.hs view
@@ -390,7 +390,15 @@ -- information from the most recent rendering. Returns 'Nothing' if -- no such state could be found, either because the name was invalid -- or because no rendering has occurred (e.g. in an 'appStartEvent'--- handler).+-- handler). An important consequence of this behavior is that if this+-- function is called before a viewport is rendered for the first+-- time, no state will be found because the renderer only knows about+-- viewports it has rendered in the most recent rendering. As a result,+-- if you need to make viewport transformations before they are drawn+-- for the first time, you may need to use 'viewportScroll' and its+-- associated functions without relying on this function. Those+-- functions queue up scrolling requests that can be made in advance of+-- the next rendering to affect the viewport. lookupViewport :: (Ord n) => n -> EventM n (Maybe Viewport) lookupViewport n = EventM $ asks (M.lookup n . eventViewportMap)
src/Brick/Widgets/Core.hs view
@@ -1191,6 +1191,11 @@ -- used to display large contents for scrolling. This function is best -- used when the contents are not too large OR when the contents are -- large and render-cacheable.+--+-- Also, be aware that there is a rich API for accessing viewport+-- information from within the 'EventM' monad; check the docs for+-- @Brick.Main@ to learn more about ways to get information about+-- viewports after they're drawn. viewport :: (Ord n, Show n) => n -- ^ The name of the viewport (must be unique and stable for@@ -1233,7 +1238,9 @@ -- Update the viewport size. let newVp = VP 0 0 newSize (0, 0)- newSize = (c^.availWidthL - vSBWidth, c^.availHeightL - hSBHeight)+ newSize = (newWidth, newHeight)+ newWidth = c^.availWidthL - vSBWidth+ newHeight = c^.availHeightL - hSBHeight vSBWidth = maybe 0 (const 1) vsOrientation hSBHeight = maybe 0 (const 1) hsOrientation doInsert (Just vp) = Just $ vp & vpSize .~ newSize@@ -1244,10 +1251,12 @@ -- Then render the viewport content widget with the rendering -- layout constraint released (but raise an exception if we are -- asked to render an infinitely-sized widget in the viewport's- -- scrolling dimension)+ -- scrolling dimension). Also note that for viewports that+ -- only scroll in one direction, we apply a constraint in the+ -- non-scrolling direction in case a scroll bar is present. let release = case typ of- Vertical -> vRelease- Horizontal -> hRelease+ Vertical -> vRelease . hLimit newWidth+ Horizontal -> hRelease . vLimit newHeight Both -> vRelease >=> hRelease released = case release p of Just w -> w@@ -1370,7 +1379,6 @@ & extentsL .~ mempty _ -> render $ addVScrollbar $ addHScrollbar- $ cropToContext $ vLimit (vpFinal^.vpSize._2) $ hLimit (vpFinal^.vpSize._1) $ padBottom Max