packages feed

brick 2.5 → 2.6

raw patch · 11 files changed

+53/−23 lines, 11 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1rAx n_a1rAy a_a1rBv. Lens (Dialog a_a1rAx n_a1rAy) (Dialog a_a1rBv n_a1rAy) [(String, n_a1rAy, a_a1rAx)] [(String, n_a1rAy, a_a1rBv)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1rM0 n_a1rM1 a_a1rMY. Lens (Dialog a_a1rM0 n_a1rM1) (Dialog a_a1rMY n_a1rM1) [(String, n_a1rM1, a_a1rM0)] [(String, n_a1rM1, a_a1rMY)]
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1rAx n_a1rAy. Lens' (Dialog a_a1rAx n_a1rAy) (Maybe (Widget n_a1rAy))
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1rM0 n_a1rM1. Lens' (Dialog a_a1rM0 n_a1rM1) (Maybe (Widget n_a1rM1))
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1rAx n_a1rAy. Lens' (Dialog a_a1rAx n_a1rAy) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1rM0 n_a1rM1. Lens' (Dialog a_a1rM0 n_a1rM1) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1jJa n_a1jJb t_a1jJV. Lens (Editor t_a1jJa n_a1jJb) (Editor t_a1jJV n_a1jJb) (TextZipper t_a1jJa) (TextZipper t_a1jJV)
+ Brick.Widgets.Edit: editContentsL :: forall t_a1jTJ n_a1jTK t_a1jUu. Lens (Editor t_a1jTJ n_a1jTK) (Editor t_a1jUu n_a1jTK) (TextZipper t_a1jTJ) (TextZipper t_a1jUu)
- Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) (List n_a1EiH FileInfo)
+ Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) (List n_a1Eua FileInfo)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) (Maybe IOException)
+ Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) (Maybe IOException)
- Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) [FileInfo]
+ Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) [FileInfo]
- Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) n_a1EiH
+ Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) n_a1Eua
- Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) (Maybe Text)
+ Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) (Maybe Text)
- Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1EiH. Lens' (FileBrowser n_a1EiH) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1Eua. Lens' (FileBrowser n_a1Eua) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) (Set String)
+ Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) (Set String)
- Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1EiH. SimpleGetter (FileBrowser n_a1EiH) FilePath
+ Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1Eua. SimpleGetter (FileBrowser n_a1Eua) FilePath
- Brick.Widgets.List: listElementsL :: forall n_a1xVZ t_a1xW0 e_a1xW1 t_a1ybA e_a1ybB. Lens (GenericList n_a1xVZ t_a1xW0 e_a1xW1) (GenericList n_a1xVZ t_a1ybA e_a1ybB) (t_a1xW0 e_a1xW1) (t_a1ybA e_a1ybB)
+ Brick.Widgets.List: listElementsL :: forall n_a1y7s t_a1y7t e_a1y7u t_a1yn3 e_a1yn4. Lens (GenericList n_a1y7s t_a1y7t e_a1y7u) (GenericList n_a1y7s t_a1yn3 e_a1yn4) (t_a1y7t e_a1y7u) (t_a1yn3 e_a1yn4)
- Brick.Widgets.List: listItemHeightL :: forall n_a1xVZ t_a1xW0 e_a1xW1. Lens' (GenericList n_a1xVZ t_a1xW0 e_a1xW1) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1y7s t_a1y7t e_a1y7u. Lens' (GenericList n_a1y7s t_a1y7t e_a1y7u) Int
- Brick.Widgets.List: listNameL :: forall n_a1xVZ t_a1xW0 e_a1xW1 n_a1ybC. Lens (GenericList n_a1xVZ t_a1xW0 e_a1xW1) (GenericList n_a1ybC t_a1xW0 e_a1xW1) n_a1xVZ n_a1ybC
+ Brick.Widgets.List: listNameL :: forall n_a1y7s t_a1y7t e_a1y7u n_a1yn5. Lens (GenericList n_a1y7s t_a1y7t e_a1y7u) (GenericList n_a1yn5 t_a1y7t e_a1y7u) n_a1y7s n_a1yn5
- Brick.Widgets.List: listSelectedL :: forall n_a1xVZ t_a1xW0 e_a1xW1. Lens' (GenericList n_a1xVZ t_a1xW0 e_a1xW1) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1y7s t_a1y7t e_a1y7u. Lens' (GenericList n_a1y7s t_a1y7t e_a1y7u) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,24 @@ Brick changelog --------------- +2.6+---++Behavior changes:+ * `Brick.Widgets.Core.relativeTo` now draws nothing if the requested+   extent is not found. Previously it would draw the specified widget in+   the upper-left corner of the layer.++Bug fixes:+ * Fixed the conditional import in `BorderMap` (#519)+ * `Brick.Widgets.Center.hCenterWith` now properly accounts for centered+   image width when computing additional right padding (#520)+ * The Brick renderer now properly resets some render-specific state+   in between renderings that was previously kept around, avoiding+   preservation of stale extents across renderings+ * `brick-tail-demo` and `brick-custom-event-demo` now shut down Vty+   properly+ 2.5 --- 
README.md view
@@ -89,6 +89,7 @@ | [`summoner-tui`](https://github.com/kowainik/summoner/tree/master/summoner-tui) | An interactive frontend to the Summoner tool | | [`swarm`](https://github.com/byorgey/swarm/) | A 2D programming and resource gathering game | | [`tart`](https://github.com/jtdaugherty/tart) | A mouse-driven ASCII art drawing program |+| [`tick-tock-tui`](https://github.com/sectore/tick-tock-tui) | A stylish TUI app to handle Bitcoin data provided by [Mempool REST API](https://mempool.space/docs/api/rest) incl. blocks, fees and price converter. | | [`tetris`](https://github.com/SamTay/tetris) | An implementation of the Tetris game | | [`thock`](https://github.com/rmehri01/thock) | A modern TUI typing game featuring online racing against friends | | [`timeloop`](https://github.com/cdupont/timeloop) | A time-travelling demonstrator |
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             2.5+version:             2.6 synopsis:            A declarative terminal user interface library description:   Write terminal user interfaces (TUIs) painlessly with 'brick'! You
programs/CustomEventDemo.hs view
@@ -82,4 +82,5 @@         writeBChan chan Counter         threadDelay 1000000 -    void $ customMainWithDefaultVty (Just chan) theApp initialState+    (_, vty) <- customMainWithDefaultVty (Just chan) theApp initialState+    V.shutdown vty
programs/LayerDemo.hs view
@@ -46,8 +46,8 @@     [ C.centerLayer $       B.border $ str "This layer is centered but other\nlayers are placed underneath it."     , arrowLayer-    , middleLayer st-    , bottomLayer st+    , middleLayer (st^.middleLayerLocation)+    , bottomLayer (st^.bottomLayerLocation)     ]  arrowLayer :: Widget Name@@ -59,15 +59,15 @@        withDefAttr arrowAttr $        str msg -middleLayer :: St -> Widget Name-middleLayer st =-    translateBy (st^.middleLayerLocation) $+middleLayer :: Location -> Widget Name+middleLayer l =+    translateBy l $     reportExtent MiddleLayerElement $     B.border $ str "Middle layer\n(Arrow keys move)" -bottomLayer :: St -> Widget Name-bottomLayer st =-    translateBy (st^.bottomLayerLocation) $+bottomLayer :: Location -> Widget Name+bottomLayer l =+    translateBy l $     B.border $ str "Bottom layer\n(Ctrl-arrow keys move)"  appEvent :: T.BrickEvent Name e -> T.EventM Name St ()
programs/TailDemo.hs view
@@ -147,4 +147,5 @@     -- Run thread to simulate incoming data     void $ forkIO $ generateLines chan -    void $ customMainWithDefaultVty (Just chan) app initialState+    (_, vty) <- customMainWithDefaultVty (Just chan) app initialState+    V.shutdown vty
src/Brick/BorderMap.hs view
@@ -17,7 +17,9 @@     ) where  import Brick.Types.Common (Edges(..), Location(..), eTopL, eBottomL, eRightL, eLeftL, origin)+#if !(MIN_VERSION_base(4,18,0)) import Control.Applicative (liftA2)+#endif import Data.IMap (IMap, Run(Run)) import GHC.Generics import Control.DeepSeq
src/Brick/Widgets/Center.hs view
@@ -60,7 +60,7 @@            c <- getContext            let rWidth = result^.imageL.to imageWidth                rHeight = result^.imageL.to imageHeight-               remainder = max 0 $ c^.availWidthL - (leftPaddingAmount * 2)+               remainder = max 0 $ c^.availWidthL - (rWidth + (leftPaddingAmount * 2))                leftPaddingAmount = max 0 $ (c^.availWidthL - rWidth) `div` 2                rightPaddingAmount = max 0 $ leftPaddingAmount + remainder                leftPadding = charFill (c^.attrL) ch leftPaddingAmount rHeight
src/Brick/Widgets/Core.hs view
@@ -1084,15 +1084,16 @@ -- | Given a widget, translate it to position it relative to the -- upper-left coordinates of a reported extent with the specified -- positioning offset. If the specified name has no reported extent,--- this just draws the specified widget with no special positioning.+-- this draws nothing on the basis that it only makes sense to draw what+-- was requested when the relative position can be known. -- -- This is only useful for positioning something in a higher layer -- relative to a reported extent in a lower layer. Any other use is--- likely to result in the specified widget being rendered as-is with--- no translation. This is because this function relies on information--- about lower layer renderings in order to work; using it with a--- resource name that wasn't rendered in a lower layer will result in--- this being equivalent to @id@.+-- likely to result in the specified widget not being rendered. This+-- is because this function relies on information about lower layer+-- renderings in order to work; using it with a resource name that+-- wasn't rendered in a lower layer will result in this being equivalent+-- to @emptyWidget@. -- -- For example, if you have two layers @topLayer@ and @bottomLayer@, -- then a widget drawn in @bottomLayer@ with @reportExtent Foo@ can be@@ -1103,7 +1104,7 @@     Widget (hSize w) (vSize w) $ do         mExt <- lookupReportedExtent n         case mExt of-            Nothing -> render w+            Nothing -> render emptyWidget             Just ext -> render $ translateBy (extentUpperLeft ext <> off) w  -- | Crop the specified widget on the left by the specified number of@@ -1253,7 +1254,6 @@         renderedClickables renderResult = do             allClickables <- use clickableNamesL             return [extentName e | e <- renderResult^.extentsL, extentName e `elem` allClickables]-  cacheLookup :: (Ord n) => n -> RenderM n (Maybe ([n], Result n)) cacheLookup n = do
src/Brick/Widgets/Edit.hs view
@@ -169,7 +169,7 @@            -> Editor T.Text n editorText = editor --- | Construct an editor over 'String' values+-- | Construct an editor over generic text values editor :: Z.GenericTextZipper a        => n        -- ^ The editor's name (must be unique)
src/Brick/Widgets/Internal.hs view
@@ -8,7 +8,7 @@   ) where -import Lens.Micro ((^.), (&), (%~))+import Lens.Micro ((^.), (&), (%~), (.~)) import Lens.Micro.Mtl ((%=)) import Control.Monad import Control.Monad.State.Strict@@ -35,7 +35,14 @@ renderFinal aMap layerRenders (w, h) chooseCursor rs =     (newRS, picWithBg, theCursor, concat layerExtents)     where-        (layerResults, !newRS) = flip runState rs $ sequence $+        -- Reset various fields from the last rendering state so they+        -- don't accumulate or affect this rendering.+        resetRs = rs & reportedExtentsL .~ mempty+                     & observedNamesL .~ mempty+                     & clickableNamesL .~ mempty+                     & requestedVisibleNames_L .~ mempty++        (layerResults, !newRS) = flip runState resetRs $ sequence $             (\p -> runReaderT p ctx) <$>             (\layerWidget -> do                 result <- render $ cropToContext layerWidget