brick 0.30 → 0.31
raw patch · 6 files changed
+31/−6 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Brick.Types: cursorLocationL :: forall n_aCKm. Lens' (CursorLocation n_aCKm) Location
+ Brick.Types: cursorLocationL :: forall n_asqS. Lens' (CursorLocation n_asqS) Location
- Brick.Types: cursorLocationNameL :: forall n_aCKm n_aD7K. Lens (CursorLocation n_aCKm) (CursorLocation n_aD7K) (Maybe n_aCKm) (Maybe n_aD7K)
+ Brick.Types: cursorLocationNameL :: forall n_asqS n_asUt. Lens (CursorLocation n_asqS) (CursorLocation n_asUt) (Maybe n_asqS) (Maybe n_asUt)
- Brick.Types: cursorsL :: forall n_aCKl. Lens' (Result n_aCKl) [CursorLocation n_aCKl]
+ Brick.Types: cursorsL :: forall n_asqR. Lens' (Result n_asqR) [CursorLocation n_asqR]
- Brick.Types: extentsL :: forall n_aCKl. Lens' (Result n_aCKl) [Extent n_aCKl]
+ Brick.Types: extentsL :: forall n_asqR. Lens' (Result n_asqR) [Extent n_asqR]
- Brick.Types: imageL :: forall n_aCKl. Lens' (Result n_aCKl) Image
+ Brick.Types: imageL :: forall n_asqR. Lens' (Result n_asqR) Image
- Brick.Types: visibilityRequestsL :: forall n_aCKl. Lens' (Result n_aCKl) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_asqR. Lens' (Result n_asqR) [VisibilityRequest]
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1hEm a_a1hEW. Lens (Dialog a_a1hEm) (Dialog a_a1hEW) [(String, a_a1hEm)] [(String, a_a1hEW)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_aQES a_aQFy. Lens (Dialog a_aQES) (Dialog a_aQFy) [(String, a_aQES)] [(String, a_aQFy)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1hEm. Lens' (Dialog a_a1hEm) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_aQES. Lens' (Dialog a_aQES) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1hEm. Lens' (Dialog a_a1hEm) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_aQES. Lens' (Dialog a_aQES) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1hEm. Lens' (Dialog a_a1hEm) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_aQES. Lens' (Dialog a_aQES) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1jpl n_a1jpm t_a1jpX. Lens (Editor t_a1jpl n_a1jpm) (Editor t_a1jpX n_a1jpm) (TextZipper t_a1jpl) (TextZipper t_a1jpX)
+ Brick.Widgets.Edit: editContentsL :: forall t_aMhx n_aMhy t_aMif. Lens (Editor t_aMhx n_aMhy) (Editor t_aMif n_aMhy) (TextZipper t_aMhx) (TextZipper t_aMif)
- Brick.Widgets.List: listElementsL :: forall n_a1ldB e_a1ldC e_a1lo2. Lens (List n_a1ldB e_a1ldC) (List n_a1ldB e_a1lo2) (Vector e_a1ldC) (Vector e_a1lo2)
+ Brick.Widgets.List: listElementsL :: forall n_aVeP e_aVeQ e_aVpU. Lens (List n_aVeP e_aVeQ) (List n_aVeP e_aVpU) (Vector e_aVeQ) (Vector e_aVpU)
- Brick.Widgets.List: listItemHeightL :: forall n_a1ldB e_a1ldC. Lens' (List n_a1ldB e_a1ldC) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_aVeP e_aVeQ. Lens' (List n_aVeP e_aVeQ) Int
- Brick.Widgets.List: listNameL :: forall n_a1ldB e_a1ldC n_a1lo3. Lens (List n_a1ldB e_a1ldC) (List n_a1lo3 e_a1ldC) n_a1ldB n_a1lo3
+ Brick.Widgets.List: listNameL :: forall n_aVeP e_aVeQ n_aVpV. Lens (List n_aVeP e_aVeQ) (List n_aVpV e_aVeQ) n_aVeP n_aVpV
- Brick.Widgets.List: listSelectedL :: forall n_a1ldB e_a1ldC. Lens' (List n_a1ldB e_a1ldC) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_aVeP e_aVeQ. Lens' (List n_aVeP e_aVeQ) (Maybe Int)
Files
- CHANGELOG.md +10/−0
- README.md +7/−0
- brick.cabal +1/−1
- src/Brick/Main.hs +12/−3
- src/Brick/Widgets/Core.hs +1/−1
- src/Brick/Widgets/Edit.hs +0/−1
CHANGELOG.md view
@@ -2,6 +2,16 @@ Brick changelog --------------- +0.31+----++Behavior changes:+ * `viewport` now implicitly causes generation of mouse events for the+ viewport when mouse mode is enabled. The mouse events are expressed+ in the coordinate system of the contents of the viewport. The+ consequence and intention of this change is to enable mouse event+ reporting for editors when clicks occur outside the known text area.+ 0.30 ----
README.md view
@@ -20,6 +20,13 @@ [vty](http://hackage.haskell.org/package/vty), so some knowledge of Vty will be helpful in using this library. +Release Announcements / News+----------------------------++Find out about `brick` releases and other news on Twitter:++https://twitter.com/brick_haskell/+ Example -------
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.30+version: 0.31 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an
src/Brick/Main.hs view
@@ -42,7 +42,7 @@ where import Control.Exception (finally)-import Lens.Micro ((^.), (&), (.~))+import Lens.Micro ((^.), (&), (.~), (%~), _1, _2) import Control.Monad (forever) import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.State@@ -75,7 +75,6 @@ import Brick.Types.Internal import Brick.Widgets.Internal import Brick.AttrMap-import qualified Brick.Widgets.Core as C -- | The library application abstraction. Your application's operations -- are represented here and passed to one of the various main functions@@ -264,7 +263,17 @@ let localCoords = Location (lc, lr) lc = c - ec + oC lr = r - er + oR- return (MouseDown n button mods localCoords, firstRS, exts)++ -- If the clicked extent was a viewport,+ -- adjust the local coordinates by+ -- adding the viewport upper-left corner+ -- offset.+ newCoords = case M.lookup n (viewportMap firstRS) of+ Nothing -> localCoords+ Just vp -> localCoords & _1 %~ (+ (vp^.vpLeft))+ & _2 %~ (+ (vp^.vpTop))++ return (MouseDown n button mods newCoords, firstRS, exts) False -> return (e, firstRS, exts) _ -> return (e, firstRS, exts) VtyEvent (EvMouseUp c r button) -> do
src/Brick/Widgets/Core.hs view
@@ -756,7 +756,7 @@ -- ^ The widget to be rendered in the scrollable viewport -> Widget n viewport vpname typ p =- Widget Greedy Greedy $ do+ clickable vpname $ Widget Greedy Greedy $ do -- First, update the viewport size. c <- getContext let newVp = VP 0 0 newSize
src/Brick/Widgets/Edit.hs view
@@ -170,7 +170,6 @@ in withAttr (if foc then editFocusedAttr else editAttr) $ limit $ viewport (e^.editorNameL) Both $- clickable (e^.editorNameL) $ (if foc then showCursor (e^.editorNameL) cursorLoc else id) $ visibleRegion cursorLoc (atCharWidth, 1) $ draw $