packages feed

brick 0.17.2 → 0.18

raw patch · 7 files changed

+44/−34 lines, 7 filesdep +data-clistPVP ok

version bump matches the API change (PVP)

Dependencies added: data-clist

API changes (from Hackage documentation)

- Brick.Focus: instance GHC.Base.Functor Brick.Focus.FocusRing
+ Brick.Focus: focusRingModify :: (CList n -> CList n) -> FocusRing n -> FocusRing n
- Brick.Types: cursorLocationL :: forall n_apZu. Lens' (CursorLocation n_apZu) Location
+ Brick.Types: cursorLocationL :: forall n_aqdt. Lens' (CursorLocation n_aqdt) Location
- Brick.Types: cursorLocationNameL :: forall n_apZu n_aqsW. Lens (CursorLocation n_apZu) (CursorLocation n_aqsW) (Maybe n_apZu) (Maybe n_aqsW)
+ Brick.Types: cursorLocationNameL :: forall n_aqdt n_aqGV. Lens (CursorLocation n_aqdt) (CursorLocation n_aqGV) (Maybe n_aqdt) (Maybe n_aqGV)
- Brick.Types: cursorsL :: forall n_apYp. Lens' (Result n_apYp) [CursorLocation n_apYp]
+ Brick.Types: cursorsL :: forall n_aqco. Lens' (Result n_aqco) [CursorLocation n_aqco]
- Brick.Types: extentsL :: forall n_apYp. Lens' (Result n_apYp) [Extent n_apYp]
+ Brick.Types: extentsL :: forall n_aqco. Lens' (Result n_aqco) [Extent n_aqco]
- Brick.Types: imageL :: forall n_apYp. Lens' (Result n_apYp) Image
+ Brick.Types: imageL :: forall n_aqco. Lens' (Result n_aqco) Image
- Brick.Types: visibilityRequestsL :: forall n_apYp. Lens' (Result n_apYp) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_aqco. Lens' (Result n_aqco) [VisibilityRequest]
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a13AY a_a13By. Lens (Dialog a_a13AY) (Dialog a_a13By) [(String, a_a13AY)] [(String, a_a13By)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a13JS a_a13Ks. Lens (Dialog a_a13JS) (Dialog a_a13Ks) [(String, a_a13JS)] [(String, a_a13Ks)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a13AY. Lens' (Dialog a_a13AY) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a13JS. Lens' (Dialog a_a13JS) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a13AY. Lens' (Dialog a_a13AY) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a13JS. Lens' (Dialog a_a13JS) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a13AY. Lens' (Dialog a_a13AY) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a13JS. Lens' (Dialog a_a13JS) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a15kI n_a15kJ. Lens' (Editor t_a15kI n_a15kJ) (TextZipper t_a15kI)
+ Brick.Widgets.Edit: editContentsL :: forall t_a15vd n_a15ve. Lens' (Editor t_a15vd n_a15ve) (TextZipper t_a15vd)
- Brick.Widgets.Edit: editDrawContentsL :: forall t_a15kI n_a15kJ. Lens' (Editor t_a15kI n_a15kJ) ([t_a15kI] -> Widget n_a15kJ)
+ Brick.Widgets.Edit: editDrawContentsL :: forall t_a15vd n_a15ve. Lens' (Editor t_a15vd n_a15ve) ([t_a15vd] -> Widget n_a15ve)
- Brick.Widgets.List: listElementsL :: forall n_a17dl e_a17dm e_a17nf. Lens (List n_a17dl e_a17dm) (List n_a17dl e_a17nf) (Vector e_a17dm) (Vector e_a17nf)
+ Brick.Widgets.List: listElementsL :: forall n_a17nQ e_a17nR e_a17xL. Lens (List n_a17nQ e_a17nR) (List n_a17nQ e_a17xL) (Vector e_a17nR) (Vector e_a17xL)
- Brick.Widgets.List: listItemHeightL :: forall n_a17dl e_a17dm. Lens' (List n_a17dl e_a17dm) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a17nQ e_a17nR. Lens' (List n_a17nQ e_a17nR) Int
- Brick.Widgets.List: listNameL :: forall n_a17dl e_a17dm n_a17ng. Lens (List n_a17dl e_a17dm) (List n_a17ng e_a17dm) n_a17dl n_a17ng
+ Brick.Widgets.List: listNameL :: forall n_a17nQ e_a17nR n_a17xM. Lens (List n_a17nQ e_a17nR) (List n_a17xM e_a17nR) n_a17nQ n_a17xM
- Brick.Widgets.List: listSelectedL :: forall n_a17dl e_a17dm. Lens' (List n_a17dl e_a17dm) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a17nQ e_a17nR. Lens' (List n_a17nQ e_a17nR) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,20 @@ Brick changelog --------------- +0.18+----++Package changes:+ * Added a dependency on data-clist.++API changes:+ * Brick.Focus: removed the Functor instance for FocusRing.+ * Brick.Focus: re-implemented FocusRing in terms of the circular list+   data structure from data-clist. In addition, this change introduced+   "focusRingModify", which permits the user to use the data-clist API+   to directly manipulate the FocusRing's internals. This way brick+   doesn't have to re-invent the wheel on the focus ring behavior.+ 0.17.2 ------ 
README.md view
@@ -25,8 +25,7 @@ Example ------- -Here's an example interface that resizes automatically when the terminal-size changes (see `programs/ReadmeDemo.hs`):+Here's an example interface (see `programs/ReadmeDemo.hs`):  ``` withBorderStyle unicode $
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.17.2+version:             0.18 synopsis:            A declarative terminal user interface library description:   Write terminal applications painlessly with 'brick'! You write an@@ -81,6 +81,7 @@   build-depends:       base <= 5,                        vty >= 5.15,                        transformers,+                       data-clist >= 0.1,                        dlist,                        containers,                        microlens >= 0.3.0.0,
src/Brick/Focus.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE DeriveFunctor #-}- -- | This module provides a type and functions for handling focus rings -- of widgets. Note that this interface is merely provided for managing -- the focus state for a sequence of resource names; it does not do@@ -14,41 +12,36 @@   , focusGetCurrent   , focusRingCursor   , withFocusRing+  , focusRingModify   ) where  import Lens.Micro ((^.)) import Data.Maybe (listToMaybe)+import qualified Data.CircularList as C  import Brick.Types import Brick.Widgets.Core (Named(..))  -- | A focus ring containing a sequence of resource names to focus and a -- currently-focused name.-data FocusRing n = FocusRingEmpty-                 | FocusRingNonempty ![n] !Int-                 deriving Functor+newtype FocusRing n = FocusRing (C.CList n)  -- | Construct a focus ring from the list of resource names. focusRing :: [n] -> FocusRing n-focusRing [] = FocusRingEmpty-focusRing names = FocusRingNonempty names 0+focusRing = FocusRing . C.fromList  -- | Advance focus to the next widget in the ring. focusNext :: FocusRing n -> FocusRing n-focusNext FocusRingEmpty = FocusRingEmpty-focusNext fr@(FocusRingNonempty [_] _) = fr-focusNext (FocusRingNonempty ns i) = FocusRingNonempty ns i'-    where-        i' = (i + 1) `mod` (length ns)+focusNext r@(FocusRing l)+    | C.isEmpty l = r+    | otherwise = FocusRing $ C.rotR l  -- | Advance focus to the previous widget in the ring. focusPrev :: FocusRing n -> FocusRing n-focusPrev FocusRingEmpty = FocusRingEmpty-focusPrev fr@(FocusRingNonempty [_] _) = fr-focusPrev (FocusRingNonempty ns i) = FocusRingNonempty ns i'-    where-        i' = (i + (length ns) - 1) `mod` (length ns)+focusPrev r@(FocusRing l)+    | C.isEmpty l = r+    | otherwise = FocusRing $ C.rotL l  -- | This function is a convenience function to look up a widget state -- value's resource name in a focus ring and set its focus setting@@ -74,8 +67,13 @@ -- | Get the currently-focused resource name from the ring. If the ring -- is emtpy, return 'Nothing'. focusGetCurrent :: FocusRing n -> Maybe n-focusGetCurrent FocusRingEmpty = Nothing-focusGetCurrent (FocusRingNonempty ns i) = Just $ ns !! i+focusGetCurrent (FocusRing l) = C.focus l++-- | Modify the internal circular list structure of a focus ring+-- directly. This function permits modification of the circular list+-- using the rich Data.CircularList API.+focusRingModify :: (C.CList n -> C.CList n) -> FocusRing n -> FocusRing n+focusRingModify f (FocusRing l) = FocusRing $ f l  -- | Cursor selection convenience function for use as an -- 'Brick.Main.appChooseCursor' value.
src/Brick/Types/Internal.hs view
@@ -206,7 +206,7 @@                     -- ^ A mouse-down event on the specified region was                     -- received.                     | MouseUp n (Maybe Button) Location-                    -- ^ A mouse-down event on the specified region was+                    -- ^ A mouse-up event on the specified region was                     -- received.                     deriving (Show, Eq) 
src/Brick/Widgets/Dialog.hs view
@@ -44,16 +44,14 @@ import Brick.AttrMap  -- | Dialogs present a window with a title (optional), a body, and--- buttons (optional). They provide a 'HandleEvent' instance that knows--- about Tab and Shift-Tab as well as ArrowLeft and ArrowRight--- for changing which button is active. Dialog--- buttons are labeled with strings and map to values of type 'a', which--- you choose.+-- buttons (optional). Dialog buttons are labeled with strings and map+-- to values of type 'a', which you choose. ----- Dialogs handle the following events by default:+-- Dialogs handle the following events by default with+-- handleDialogEvent: ----- * Tab: selecte the next button--- * Shift-tab: select the previous button+-- * Tab or Right Arrow: select the next button+-- * Shift-tab or Left Arrow: select the previous button data Dialog a =     Dialog { dialogTitle :: Maybe String            -- ^ The dialog title
src/Brick/Widgets/Edit.hs view
@@ -8,9 +8,9 @@ -- of the editor, just use 'getEditContents'. To modify it, use the -- 'Z.TextZipper' interface with 'applyEdit'. ----- The editor's 'HandleEvent' instance handles a set of basic input--- events that should suffice for most purposes; see the source for a--- complete list.+-- The editor's 'handleEditorEvent' function handles a set of basic+-- input events that should suffice for most purposes; see the source+-- for a complete list. -- -- Bear in mind that the editor provided by this module is intended to -- provide basic input support for brick applications but it is not