packages feed

brick 0.69 → 0.69.1

raw patch · 5 files changed

+43/−11 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Brick.Widgets.Core: relativeTo :: (Show n, Ord n) => n -> Location -> Widget n -> Widget n
+ Brick.Widgets.Core: relativeTo :: Ord n => n -> Location -> Widget n -> Widget n
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1fvI a_a1fwm. Lens (Dialog a_a1fvI) (Dialog a_a1fwm) [(String, a_a1fvI)] [(String, a_a1fwm)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1fxe a_a1fxS. Lens (Dialog a_a1fxe) (Dialog a_a1fxS) [(String, a_a1fxe)] [(String, a_a1fxS)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1fvI. Lens' (Dialog a_a1fvI) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1fxe. Lens' (Dialog a_a1fxe) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1fvI. Lens' (Dialog a_a1fvI) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1fxe. Lens' (Dialog a_a1fxe) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1fvI. Lens' (Dialog a_a1fvI) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1fxe. Lens' (Dialog a_a1fxe) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a19M1 n_a19M2 t_a19MG. Lens (Editor t_a19M1 n_a19M2) (Editor t_a19MG n_a19M2) (TextZipper t_a19M1) (TextZipper t_a19MG)
+ Brick.Widgets.Edit: editContentsL :: forall t_a19LW n_a19LX t_a19MB. Lens (Editor t_a19LW n_a19LX) (Editor t_a19MB n_a19LX) (TextZipper t_a19LW) (TextZipper t_a19MB)
- Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) (List n_a1pRB FileInfo)
+ Brick.Widgets.FileBrowser: fileBrowserEntriesG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) (List n_a1pT6 FileInfo)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) (Maybe IOException)
+ Brick.Widgets.FileBrowser: fileBrowserExceptionG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) (Maybe IOException)
- Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) [FileInfo]
+ Brick.Widgets.FileBrowser: fileBrowserLatestResultsG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) [FileInfo]
- Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) n_a1pRB
+ Brick.Widgets.FileBrowser: fileBrowserNameG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) n_a1pT6
- Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) (Maybe Text)
+ Brick.Widgets.FileBrowser: fileBrowserSearchStringG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) (Maybe Text)
- Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1pRB. Lens' (FileBrowser n_a1pRB) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1pT6. Lens' (FileBrowser n_a1pT6) (FileInfo -> Bool)
- Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) (Set String)
+ Brick.Widgets.FileBrowser: fileBrowserSelectedFilesG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) (Set String)
- Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1pRB. SimpleGetter (FileBrowser n_a1pRB) FilePath
+ Brick.Widgets.FileBrowser: fileBrowserWorkingDirectoryG :: forall n_a1pT6. SimpleGetter (FileBrowser n_a1pT6) FilePath
- Brick.Widgets.List: listElementsL :: forall n_a1kFJ t_a1kFK e_a1kFL t_a1kTP e_a1kTQ. Lens (GenericList n_a1kFJ t_a1kFK e_a1kFL) (GenericList n_a1kFJ t_a1kTP e_a1kTQ) (t_a1kFK e_a1kFL) (t_a1kTP e_a1kTQ)
+ Brick.Widgets.List: listElementsL :: forall n_a1kHe t_a1kHf e_a1kHg t_a1kVk e_a1kVl. Lens (GenericList n_a1kHe t_a1kHf e_a1kHg) (GenericList n_a1kHe t_a1kVk e_a1kVl) (t_a1kHf e_a1kHg) (t_a1kVk e_a1kVl)
- Brick.Widgets.List: listItemHeightL :: forall n_a1kFJ t_a1kFK e_a1kFL. Lens' (GenericList n_a1kFJ t_a1kFK e_a1kFL) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1kHe t_a1kHf e_a1kHg. Lens' (GenericList n_a1kHe t_a1kHf e_a1kHg) Int
- Brick.Widgets.List: listNameL :: forall n_a1kFJ t_a1kFK e_a1kFL n_a1kTR. Lens (GenericList n_a1kFJ t_a1kFK e_a1kFL) (GenericList n_a1kTR t_a1kFK e_a1kFL) n_a1kFJ n_a1kTR
+ Brick.Widgets.List: listNameL :: forall n_a1kHe t_a1kHf e_a1kHg n_a1kVm. Lens (GenericList n_a1kHe t_a1kHf e_a1kHg) (GenericList n_a1kVm t_a1kHf e_a1kHg) n_a1kHe n_a1kVm
- Brick.Widgets.List: listSelectedL :: forall n_a1kFJ t_a1kFK e_a1kFL. Lens' (GenericList n_a1kFJ t_a1kFK e_a1kFL) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1kHe t_a1kHf e_a1kHg. Lens' (GenericList n_a1kHe t_a1kHf e_a1kHg) (Maybe Int)

Files

CHANGELOG.md view
@@ -2,6 +2,14 @@ Brick changelog --------------- +0.69.1+------++Bug fixes:+ * `table` can now deal properly with empty cells that are in left- and+   top-aligned settings. Previously, empty cells in those settings would+   break table rendering. (#369)+ 0.69 ---- 
brick.cabal view
@@ -1,5 +1,5 @@ name:                brick-version:             0.69+version:             0.69.1 synopsis:            A declarative terminal user interface library description:   Write terminal user interfaces (TUIs) painlessly with 'brick'! You
programs/LayerDemo.hs view
@@ -1,7 +1,11 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} module Main where +#if !(MIN_VERSION_base(4,11,0))+import Data.Monoid ((<>))+#endif import Lens.Micro ((^.), (&), (%~)) import Lens.Micro.TH (makeLenses) import Control.Monad (void)
src/Brick/Widgets/Core.hs view
@@ -1033,11 +1033,22 @@  -- | Given a widget, translate it to position it relative to the -- upper-left coordinates of a reported extent with the specified--- positioning offset. This is useful for positioning something in a--- higher layer relative to a reported extent in a lower layer. If the--- specified name has no reported extent, this just draws the specified--- widget with no special positioning.-relativeTo :: (Show n, Ord n) => n -> Location -> Widget n -> Widget n+-- positioning offset. If the specified name has no reported extent,+-- this just draws the specified widget with no special positioning.+--+-- 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@.+--+-- For example, if you have two layers @topLayer@ and @bottomLayer@,+-- then a widget drawn in @bottomLayer@ with @reportExtent Foo@ can be+-- used to relatively position a widget in @topLayer@ with @topLayer =+-- relativeTo Foo ...@.+relativeTo :: (Ord n) => n -> Location -> Widget n -> Widget n relativeTo n off w =     Widget (hSize w) (vSize w) $ do         mExt <- lookupReportedExtent n
src/Brick/Widgets/Table.hs view
@@ -34,7 +34,8 @@ import qualified Control.Exception as E import Data.List (transpose, intersperse, nub) import qualified Data.Map as M-import Graphics.Vty (imageHeight, imageWidth)+import Graphics.Vty (imageHeight, imageWidth, charFill)+import Lens.Micro ((^.))  import Brick.Types import Brick.Widgets.Core@@ -106,7 +107,9 @@ -- 'TableException'. -- -- All rows must have the same number of cells. If not, this will raise--- a 'TableException'.+-- a 'TableException'. In addition, all rows and columns must provide at+-- least one non-empty cell respectively, or the final result may not+-- look as desired. table :: [[Widget n]] -> Table n table rows =     if not allFixed@@ -204,6 +207,7 @@     joinBorders $     (if drawSurroundingBorder t then border else id) $     Widget Fixed Fixed $ do+        ctx <- getContext         let rows = tableRows t         cellResults <- forM rows $ mapM render         let rowHeights = rowHeight <$> cellResults@@ -221,20 +225,25 @@                 Widget Fixed Fixed $ do                     result <- render w                     case align of-                        AlignLeft -> return result+                        AlignLeft -> render $ hLimit width $ padRight Max $ toW result                         AlignCenter -> render $ hLimit width $ hCenter $ toW result                         AlignRight -> render $                                           padLeft (Pad (width - imageWidth (image result))) $                                           toW result             applyRowAlignment rHeight align result =                 case align of-                 AlignTop -> toW result+                 AlignTop -> vLimit rHeight $ padBottom Max $ toW result                  AlignMiddle -> vLimit rHeight $ vCenter $ toW result                  AlignBottom -> vLimit rHeight $ padTop Max $ toW result+            fixEmtpyCell w h result =+                if imageWidth (image result) == 0 && imageHeight (image result) == 0+                then result { image = charFill (ctx^.attrL) ' ' w h }+                else result             mkColumn (hAlign, width, colCells) = do                 let paddedCells = flip map (zip3 allRowAligns rowHeights colCells) $ \(vAlign, rHeight, cell) ->                         applyColAlignment hAlign width $-                        applyRowAlignment rHeight vAlign cell+                        applyRowAlignment rHeight vAlign $+                        fixEmtpyCell width rHeight cell                     maybeRowBorders = if drawRowBorders t                                       then intersperse (hLimit width hBorder)                                       else id