packages feed

brick 0.66.1 → 0.67

raw patch · 6 files changed

+48/−12 lines, 6 filesdep ~vtyPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: vty

API changes (from Hackage documentation)

- Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1pvs. Lens' (FileBrowser n_a1pvs) (Maybe (FileInfo -> Bool))
+ Brick.Types: suffixLensesWith :: String -> LensRules -> Name -> DecsQ
+ Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) (List n_a1pvT FileInfo)
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) (Maybe IOException)
+ Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) [FileInfo]
+ Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) n_a1pvT
+ Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) (Maybe Text)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) (Set String)
+ Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1pvT. SimpleGetter (FileBrowser n_a1pvT) FilePath
- Brick.BorderMap: eBottomL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.BorderMap: eBottomL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.BorderMap: eLeftL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.BorderMap: eLeftL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.BorderMap: eRightL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.BorderMap: eRightL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.BorderMap: eTopL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.BorderMap: eTopL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.Types: availHeightL :: forall n_awO8. Lens' (Context n_awO8) Int
+ Brick.Types: availHeightL :: forall n_awOO. Lens' (Context n_awOO) Int
- Brick.Types: availWidthL :: forall n_awO8. Lens' (Context n_awO8) Int
+ Brick.Types: availWidthL :: forall n_awOO. Lens' (Context n_awOO) Int
- Brick.Types: bordersL :: forall n_awOc. Lens' (Result n_awOc) (BorderMap DynBorder)
+ Brick.Types: bordersL :: forall n_awOS. Lens' (Result n_awOS) (BorderMap DynBorder)
- Brick.Types: ctxAttrMapL :: forall n_awO8. Lens' (Context n_awO8) AttrMap
+ Brick.Types: ctxAttrMapL :: forall n_awOO. Lens' (Context n_awOO) AttrMap
- Brick.Types: ctxAttrNameL :: forall n_awO8. Lens' (Context n_awO8) AttrName
+ Brick.Types: ctxAttrNameL :: forall n_awOO. Lens' (Context n_awOO) AttrName
- Brick.Types: ctxBorderStyleL :: forall n_awO8. Lens' (Context n_awO8) BorderStyle
+ Brick.Types: ctxBorderStyleL :: forall n_awOO. Lens' (Context n_awOO) BorderStyle
- Brick.Types: ctxDynBordersL :: forall n_awO8. Lens' (Context n_awO8) Bool
+ Brick.Types: ctxDynBordersL :: forall n_awOO. Lens' (Context n_awOO) Bool
- Brick.Types: ctxHScrollBarOrientationL :: forall n_awO8. Lens' (Context n_awO8) (Maybe HScrollBarOrientation)
+ Brick.Types: ctxHScrollBarOrientationL :: forall n_awOO. Lens' (Context n_awOO) (Maybe HScrollBarOrientation)
- Brick.Types: ctxHScrollBarRendererL :: forall n_awO8. Lens' (Context n_awO8) (Maybe (ScrollbarRenderer n_awO8))
+ Brick.Types: ctxHScrollBarRendererL :: forall n_awOO. Lens' (Context n_awOO) (Maybe (ScrollbarRenderer n_awOO))
- Brick.Types: ctxVScrollBarOrientationL :: forall n_awO8. Lens' (Context n_awO8) (Maybe VScrollBarOrientation)
+ Brick.Types: ctxVScrollBarOrientationL :: forall n_awOO. Lens' (Context n_awOO) (Maybe VScrollBarOrientation)
- Brick.Types: ctxVScrollBarRendererL :: forall n_awO8. Lens' (Context n_awO8) (Maybe (ScrollbarRenderer n_awO8))
+ Brick.Types: ctxVScrollBarRendererL :: forall n_awOO. Lens' (Context n_awOO) (Maybe (ScrollbarRenderer n_awOO))
- Brick.Types: cursorLocationL :: forall n_awOd. Lens' (CursorLocation n_awOd) Location
+ Brick.Types: cursorLocationL :: forall n_awOT. Lens' (CursorLocation n_awOT) Location
- Brick.Types: cursorLocationNameL :: forall n_awOd n_ayWg. Lens (CursorLocation n_awOd) (CursorLocation n_ayWg) (Maybe n_awOd) (Maybe n_ayWg)
+ Brick.Types: cursorLocationNameL :: forall n_awOT n_ayWW. Lens (CursorLocation n_awOT) (CursorLocation n_ayWW) (Maybe n_awOT) (Maybe n_ayWW)
- Brick.Types: cursorsL :: forall n_awOc. Lens' (Result n_awOc) [CursorLocation n_awOc]
+ Brick.Types: cursorsL :: forall n_awOS. Lens' (Result n_awOS) [CursorLocation n_awOS]
- Brick.Types: eBottomL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.Types: eBottomL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.Types: eLeftL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.Types: eLeftL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.Types: eRightL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.Types: eRightL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.Types: eTopL :: forall a_acYj. Lens' (Edges a_acYj) a_acYj
+ Brick.Types: eTopL :: forall a_acYZ. Lens' (Edges a_acYZ) a_acYZ
- Brick.Types: extentsL :: forall n_awOc. Lens' (Result n_awOc) [Extent n_awOc]
+ Brick.Types: extentsL :: forall n_awOS. Lens' (Result n_awOS) [Extent n_awOS]
- Brick.Types: imageL :: forall n_awOc. Lens' (Result n_awOc) Image
+ Brick.Types: imageL :: forall n_awOS. Lens' (Result n_awOS) Image
- Brick.Types: visibilityRequestsL :: forall n_awOc. Lens' (Result n_awOc) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_awOS. Lens' (Result n_awOS) [VisibilityRequest]
- Brick.Types: windowHeightL :: forall n_awO8. Lens' (Context n_awO8) Int
+ Brick.Types: windowHeightL :: forall n_awOO. Lens' (Context n_awOO) Int
- Brick.Types: windowWidthL :: forall n_awO8. Lens' (Context n_awO8) Int
+ Brick.Types: windowWidthL :: forall n_awOO. Lens' (Context n_awOO) Int
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1f7Z a_a1f8D. Lens (Dialog a_a1f7Z) (Dialog a_a1f8D) [(String, a_a1f7Z)] [(String, a_a1f8D)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1f8F a_a1f9j. Lens (Dialog a_a1f8F) (Dialog a_a1f9j) [(String, a_a1f8F)] [(String, a_a1f9j)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1f7Z. Lens' (Dialog a_a1f7Z) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1f8F. Lens' (Dialog a_a1f8F) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1f7Z. Lens' (Dialog a_a1f7Z) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1f8F. Lens' (Dialog a_a1f8F) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1f7Z. Lens' (Dialog a_a1f7Z) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1f8F. Lens' (Dialog a_a1f8F) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a19ou n_a19ov t_a19p9. Lens (Editor t_a19ou n_a19ov) (Editor t_a19p9 n_a19ov) (TextZipper t_a19ou) (TextZipper t_a19p9)
+ Brick.Widgets.Edit: editContentsL :: forall t_a19pa n_a19pb t_a19pP. Lens (Editor t_a19pa n_a19pb) (Editor t_a19pP n_a19pb) (TextZipper t_a19pa) (TextZipper t_a19pP)
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1pvs. Lens' (FileBrowser n_a1pvs) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1pvT. Lens' (FileBrowser n_a1pvT) (FileInfo -> Bool)
- Brick.Widgets.List: listElementsL :: forall n_a1kjx t_a1kjy e_a1kjz t_a1kxE e_a1kxF. Lens (GenericList n_a1kjx t_a1kjy e_a1kjz) (GenericList n_a1kjx t_a1kxE e_a1kxF) (t_a1kjy e_a1kjz) (t_a1kxE e_a1kxF)
+ Brick.Widgets.List: listElementsL :: forall n_a1kk0 t_a1kk1 e_a1kk2 t_a1ky7 e_a1ky8. Lens (GenericList n_a1kk0 t_a1kk1 e_a1kk2) (GenericList n_a1kk0 t_a1ky7 e_a1ky8) (t_a1kk1 e_a1kk2) (t_a1ky7 e_a1ky8)
- Brick.Widgets.List: listItemHeightL :: forall n_a1kjx t_a1kjy e_a1kjz. Lens' (GenericList n_a1kjx t_a1kjy e_a1kjz) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1kk0 t_a1kk1 e_a1kk2. Lens' (GenericList n_a1kk0 t_a1kk1 e_a1kk2) Int
- Brick.Widgets.List: listNameL :: forall n_a1kjx t_a1kjy e_a1kjz n_a1kxG. Lens (GenericList n_a1kjx t_a1kjy e_a1kjz) (GenericList n_a1kxG t_a1kjy e_a1kjz) n_a1kjx n_a1kxG
+ Brick.Widgets.List: listNameL :: forall n_a1kk0 t_a1kk1 e_a1kk2 n_a1ky9. Lens (GenericList n_a1kk0 t_a1kk1 e_a1kk2) (GenericList n_a1ky9 t_a1kk1 e_a1kk2) n_a1kk0 n_a1ky9
- Brick.Widgets.List: listSelectedL :: forall n_a1kjx t_a1kjy e_a1kjz. Lens' (GenericList n_a1kjx t_a1kjy e_a1kjz) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1kk0 t_a1kk1 e_a1kk2. Lens' (GenericList n_a1kk0 t_a1kk1 e_a1kk2) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,20 @@ Brick changelog --------------- +0.67+----++API changes:+ * `Brick.Widgets.FileBrowser` now exports getters for all+   `FileBrowser` fields. These getters are lens-like accessors+   with the `G` suffix.+ * `Brick.Widgets.FileBrowser` no longer exports the+   `fileBrowserEntryFilterL` lens. The lens broke the API+   because it allowed modification of internal state that could+   lead to inconsistency in the UI. Users who needed to use+   `fileBrowserEntryFilterL` before this change should use+   `setFileBrowserEntryFilter` instead.+ 0.66.1 ------ 
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.66.1+version:             0.67 synopsis:            A declarative terminal user interface library description:   Write terminal user interfaces (TUIs) painlessly with 'brick'! You
src/Brick/Focus.hs view
@@ -16,7 +16,7 @@ where  import Lens.Micro ((^.))-import Data.Maybe (listToMaybe)+import Data.List (find) import qualified Data.CircularList as C  import Brick.Types@@ -64,7 +64,7 @@ withFocusRing ring f a = f (focusGetCurrent ring == Just (getName a)) a  -- | Get the currently-focused resource name from the ring. If the ring--- is emtpy, return 'Nothing'.+-- is empty, return 'Nothing'. focusGetCurrent :: FocusRing n -> Maybe n focusGetCurrent (FocusRing l) = C.focus l @@ -107,8 +107,5 @@                 -> Maybe (CursorLocation n)                 -- ^ The cursor position, if any, that matches the                 -- resource name currently focused by the 'FocusRing'.-focusRingCursor getRing st ls =-    listToMaybe $ filter isCurrent ls-    where-        isCurrent cl = cl^.cursorLocationNameL ==-                       (focusGetCurrent $ getRing st)+focusRingCursor getRing st = find $ \cl ->+    cl^.cursorLocationNameL == focusGetCurrent (getRing st)
src/Brick/Types.hs view
@@ -72,6 +72,7 @@    -- * Making lenses   , suffixLenses+  , suffixLensesWith    -- * Dynamic borders   , bordersL
src/Brick/Types/TH.hs view
@@ -1,5 +1,6 @@ module Brick.Types.TH   ( suffixLenses+  , suffixLensesWith   ) where @@ -7,7 +8,7 @@ import qualified Language.Haskell.TH.Lib as TH  import Lens.Micro ((&), (.~))-import Lens.Micro.TH (DefName(..), makeLensesWith, lensRules, lensField)+import Lens.Micro.TH (DefName(..), LensRules, makeLensesWith, lensRules, lensField)  -- | A template haskell function to build lenses for a record type. This -- function differs from the 'Control.Lens.makeLenses' function in that@@ -15,5 +16,10 @@ -- and it adds an "L" suffix to lens names to make it clear that they -- are lenses. suffixLenses :: TH.Name -> TH.DecsQ-suffixLenses = makeLensesWith $-  lensRules & lensField .~ (\_ _ name -> [TopName $ TH.mkName $ TH.nameBase name ++ "L"])+suffixLenses = suffixLensesWith "L" lensRules++-- | A more general version of 'suffixLenses' that allows customization+-- of the lens-building rules and allows customization of the suffix.+suffixLensesWith :: String -> LensRules -> TH.Name -> TH.DecsQ+suffixLensesWith suffix rs = makeLensesWith $+    rs & lensField .~ (\_ _ name -> [TopName $ TH.mkName $ TH.nameBase name ++ suffix])
src/Brick/Widgets/FileBrowser.hs view
@@ -111,7 +111,6 @@   , fileExtensionMatch    -- * Lenses-  , fileBrowserEntryFilterL   , fileBrowserSelectableL   , fileInfoFilenameL   , fileInfoSanitizedFilenameL@@ -121,6 +120,17 @@   , fileStatusSizeL   , fileStatusFileTypeL +  -- * Getters+  , fileBrowserEntryFilterG+  , fileBrowserWorkingDirectoryG+  , fileBrowserEntriesG+  , fileBrowserLatestResultsG+  , fileBrowserSelectedFilesG+  , fileBrowserNameG+  , fileBrowserSearchStringG+  , fileBrowserExceptionG+  , fileBrowserSelectableG+   -- * Miscellaneous   , prettyFileSize @@ -145,6 +155,7 @@ import qualified Data.Set as Set import qualified Data.Vector as V import Lens.Micro+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@@ -238,6 +249,7 @@     deriving (Read, Show, Eq)  suffixLenses ''FileBrowser+suffixLensesWith "G" (lensRules & generateUpdateableOptics .~ False) ''FileBrowser suffixLenses ''FileInfo suffixLenses ''FileStatus @@ -311,6 +323,12 @@ -- indicates no filtering, meaning all entries will be shown. 'Just' -- indicates a function that should return 'True' for entries that -- should be permitted to appear.+--+-- Note that this applies the filter after setting it by updating the+-- listed entries to reflect the result of the filter. That is unlike+-- setting the filter with the 'fileBrowserEntryFilterL' lens directly,+-- which just sets the filter but does not (and cannot) update the+-- listed entries. setFileBrowserEntryFilter :: Maybe (FileInfo -> Bool) -> FileBrowser n -> FileBrowser n setFileBrowserEntryFilter f b =     applyFilterAndSearch $ b & fileBrowserEntryFilterL .~ f