brick 0.50 → 0.50.1
raw patch · 4 files changed
+63/−29 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Brick.Focus: focusRingLength :: FocusRing n -> Int
- Brick.BorderMap: eBottomL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.BorderMap: eBottomL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.BorderMap: eLeftL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.BorderMap: eLeftL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.BorderMap: eRightL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.BorderMap: eRightL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.BorderMap: eTopL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.BorderMap: eTopL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.Types: bordersL :: forall n_aGnm. Lens' (Result n_aGnm) (BorderMap DynBorder)
+ Brick.Types: bordersL :: forall n_aGnz. Lens' (Result n_aGnz) (BorderMap DynBorder)
- Brick.Types: cursorLocationL :: forall n_aF1X. Lens' (CursorLocation n_aF1X) Location
+ Brick.Types: cursorLocationL :: forall n_aF2a. Lens' (CursorLocation n_aF2a) Location
- Brick.Types: cursorLocationNameL :: forall n_aF1X n_aH0y. Lens (CursorLocation n_aF1X) (CursorLocation n_aH0y) (Maybe n_aF1X) (Maybe n_aH0y)
+ Brick.Types: cursorLocationNameL :: forall n_aF2a n_aH0L. Lens (CursorLocation n_aF2a) (CursorLocation n_aH0L) (Maybe n_aF2a) (Maybe n_aH0L)
- Brick.Types: cursorsL :: forall n_aGnm. Lens' (Result n_aGnm) [CursorLocation n_aGnm]
+ Brick.Types: cursorsL :: forall n_aGnz. Lens' (Result n_aGnz) [CursorLocation n_aGnz]
- Brick.Types: eBottomL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.Types: eBottomL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.Types: eLeftL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.Types: eLeftL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.Types: eRightL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.Types: eRightL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.Types: eTopL :: forall a_aj9i. Lens' (Edges a_aj9i) a_aj9i
+ Brick.Types: eTopL :: forall a_aj9v. Lens' (Edges a_aj9v) a_aj9v
- Brick.Types: extentsL :: forall n_aGnm. Lens' (Result n_aGnm) [Extent n_aGnm]
+ Brick.Types: extentsL :: forall n_aGnz. Lens' (Result n_aGnz) [Extent n_aGnz]
- Brick.Types: imageL :: forall n_aGnm. Lens' (Result n_aGnm) Image
+ Brick.Types: imageL :: forall n_aGnz. Lens' (Result n_aGnz) Image
- Brick.Types: visibilityRequestsL :: forall n_aGnm. Lens' (Result n_aGnm) [VisibilityRequest]
+ Brick.Types: visibilityRequestsL :: forall n_aGnz. Lens' (Result n_aGnz) [VisibilityRequest]
- Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1gHU a_a1gIB. Lens (Dialog a_a1gHU) (Dialog a_a1gIB) [(String, a_a1gHU)] [(String, a_a1gIB)]
+ Brick.Widgets.Dialog: dialogButtonsL :: forall a_a1gIb a_a1gIS. Lens (Dialog a_a1gIb) (Dialog a_a1gIS) [(String, a_a1gIb)] [(String, a_a1gIS)]
- Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1gHU. Lens' (Dialog a_a1gHU) (Maybe Int)
+ Brick.Widgets.Dialog: dialogSelectedIndexL :: forall a_a1gIb. Lens' (Dialog a_a1gIb) (Maybe Int)
- Brick.Widgets.Dialog: dialogTitleL :: forall a_a1gHU. Lens' (Dialog a_a1gHU) (Maybe String)
+ Brick.Widgets.Dialog: dialogTitleL :: forall a_a1gIb. Lens' (Dialog a_a1gIb) (Maybe String)
- Brick.Widgets.Dialog: dialogWidthL :: forall a_a1gHU. Lens' (Dialog a_a1gHU) Int
+ Brick.Widgets.Dialog: dialogWidthL :: forall a_a1gIb. Lens' (Dialog a_a1gIb) Int
- Brick.Widgets.Edit: editContentsL :: forall t_a1bCn n_a1bCo t_a1bD7. Lens (Editor t_a1bCn n_a1bCo) (Editor t_a1bD7 n_a1bCo) (TextZipper t_a1bCn) (TextZipper t_a1bD7)
+ Brick.Widgets.Edit: editContentsL :: forall t_a1bCE n_a1bCF t_a1bDo. Lens (Editor t_a1bCE n_a1bCF) (Editor t_a1bDo n_a1bCF) (TextZipper t_a1bCE) (TextZipper t_a1bDo)
- Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1rb5. Lens' (FileBrowser n_a1rb5) (Maybe (FileInfo -> Bool))
+ Brick.Widgets.FileBrowser: fileBrowserEntryFilterL :: forall n_a1rbd. Lens' (FileBrowser n_a1rbd) (Maybe (FileInfo -> Bool))
- Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1rb5. Lens' (FileBrowser n_a1rb5) (FileInfo -> Bool)
+ Brick.Widgets.FileBrowser: fileBrowserSelectableL :: forall n_a1rbd. Lens' (FileBrowser n_a1rbd) (FileInfo -> Bool)
- Brick.Widgets.List: listElementsL :: forall n_a1lOr t_a1lOs e_a1lOt t_a1m31 e_a1m32. Lens (GenericList n_a1lOr t_a1lOs e_a1lOt) (GenericList n_a1lOr t_a1m31 e_a1m32) (t_a1lOs e_a1lOt) (t_a1m31 e_a1m32)
+ Brick.Widgets.List: listElementsL :: forall n_a1lOz t_a1lOA e_a1lOB t_a1m39 e_a1m3a. Lens (GenericList n_a1lOz t_a1lOA e_a1lOB) (GenericList n_a1lOz t_a1m39 e_a1m3a) (t_a1lOA e_a1lOB) (t_a1m39 e_a1m3a)
- Brick.Widgets.List: listItemHeightL :: forall n_a1lOr t_a1lOs e_a1lOt. Lens' (GenericList n_a1lOr t_a1lOs e_a1lOt) Int
+ Brick.Widgets.List: listItemHeightL :: forall n_a1lOz t_a1lOA e_a1lOB. Lens' (GenericList n_a1lOz t_a1lOA e_a1lOB) Int
- Brick.Widgets.List: listNameL :: forall n_a1lOr t_a1lOs e_a1lOt n_a1m33. Lens (GenericList n_a1lOr t_a1lOs e_a1lOt) (GenericList n_a1m33 t_a1lOs e_a1lOt) n_a1lOr n_a1m33
+ Brick.Widgets.List: listNameL :: forall n_a1lOz t_a1lOA e_a1lOB n_a1m3b. Lens (GenericList n_a1lOz t_a1lOA e_a1lOB) (GenericList n_a1m3b t_a1lOA e_a1lOB) n_a1lOz n_a1m3b
- Brick.Widgets.List: listSelectedL :: forall n_a1lOr t_a1lOs e_a1lOt. Lens' (GenericList n_a1lOr t_a1lOs e_a1lOt) (Maybe Int)
+ Brick.Widgets.List: listSelectedL :: forall n_a1lOz t_a1lOA e_a1lOB. Lens' (GenericList n_a1lOz t_a1lOA e_a1lOB) (Maybe Int)
Files
- CHANGELOG.md +15/−0
- brick.cabal +3/−3
- src/Brick/Focus.hs +5/−0
- src/Brick/Widgets/FileBrowser.hs +40/−26
CHANGELOG.md view
@@ -2,6 +2,21 @@ Brick changelog --------------- +0.50.1+------++Bug fixes:+ * Fixed a bug where a self-referential symlink would cause the file+ browser to get into a loop and ultimately crash. (Thanks Kevin Quick)++API changes:+ * Added `Brick.Focus.focusRingLength` to get the size of a focus ring.+ (Thanks Róman Joost)++Other changes:+ * Updated Travis configuration and base dependency to support GHC+ 8.8.1. (thanks Brandon Hamilton)+ 0.50 ----
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 0.50+version: 0.50.1 synopsis: A declarative terminal user interface library description: Write terminal applications painlessly with 'brick'! You write an@@ -37,7 +37,7 @@ cabal-version: 1.18 Homepage: https://github.com/jtdaugherty/brick/ Bug-reports: https://github.com/jtdaugherty/brick/issues-tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.6.5+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.6.5, GHC == 8.8.1 extra-doc-files: README.md, docs/guide.rst,@@ -87,7 +87,7 @@ Brick.Types.Internal Brick.Widgets.Internal - build-depends: base <= 4.12.0.0,+ build-depends: base <= 4.13.0.0, vty >= 5.24, transformers, data-clist >= 0.1,
src/Brick/Focus.hs view
@@ -9,6 +9,7 @@ , focusPrev , focusGetCurrent , focusSetCurrent+ , focusRingLength , focusRingCursor , withFocusRing , focusRingModify@@ -75,6 +76,10 @@ case C.rotateTo n l of Nothing -> r Just l' -> FocusRing l'++-- | Get the size of the FocusRing.+focusRingLength :: FocusRing n -> Int+focusRingLength (FocusRing l) = C.size l -- | Modify the internal circular list structure of a focus ring -- directly. This function permits modification of the circular list
src/Brick/Widgets/FileBrowser.hs view
@@ -347,35 +347,49 @@ -- ^ The actual full path to the file or directory to -- inspect. -> IO FileInfo-getFileInfo name fullPath = do- filePath <- D.makeAbsolute fullPath- statusResult <- E.try $ U.getSymbolicLinkStatus filePath+getFileInfo name = go []+ where+ go history fullPath = do+ filePath <- D.makeAbsolute fullPath+ statusResult <- E.try $ U.getSymbolicLinkStatus filePath - let stat = do- status <- statusResult- let U.COff sz = U.fileSize status- return FileStatus { fileStatusFileType = fileTypeFromStatus status- , fileStatusSize = sz- }+ let stat = do+ status <- statusResult+ let U.COff sz = U.fileSize status+ return FileStatus { fileStatusFileType = fileTypeFromStatus status+ , fileStatusSize = sz+ } - targetTy <- case fileStatusFileType <$> stat of- Right (Just SymbolicLink) -> do- targetPathResult <- E.try $ U.readSymbolicLink filePath- case targetPathResult of- Left (_::E.SomeException) -> return Nothing- Right targetPath -> do- targetInfo <- liftIO $ getFileInfo "unused" targetPath- case fileInfoFileStatus targetInfo of- Right (FileStatus _ targetTy) -> return targetTy- _ -> return Nothing- _ -> return Nothing+ targetTy <- case fileStatusFileType <$> stat of+ Right (Just SymbolicLink) -> do+ targetPathResult <- E.try $ U.readSymbolicLink filePath+ case targetPathResult of+ Left (_::E.SomeException) -> return Nothing+ Right targetPath ->+ -- Watch out for recursive symlink chains:+ -- if history starts repeating, abort the+ -- symlink following process.+ --+ -- Examples:+ -- $ ln -s foo foo+ --+ -- $ ln -s foo bar+ -- $ ln -s bar foo+ if targetPath `elem` history+ then return Nothing+ else do+ targetInfo <- liftIO $ go (fullPath : history) targetPath+ case fileInfoFileStatus targetInfo of+ Right (FileStatus _ targetTy) -> return targetTy+ _ -> return Nothing+ _ -> return Nothing - return FileInfo { fileInfoFilename = name- , fileInfoFilePath = filePath- , fileInfoSanitizedFilename = sanitizeFilename name- , fileInfoFileStatus = stat- , fileInfoLinkTargetType = targetTy- }+ return FileInfo { fileInfoFilename = name+ , fileInfoFilePath = filePath+ , fileInfoSanitizedFilename = sanitizeFilename name+ , fileInfoFileStatus = stat+ , fileInfoLinkTargetType = targetTy+ } -- | Get the file type for this file info entry. If the file type could -- not be obtained due to an 'IOException', return 'Nothing'.