Merge master

This commit is contained in:
Jonathan Daugherty 2020-07-09 15:22:01 -07:00
commit 129da5601b
6 changed files with 44 additions and 15 deletions

View File

@ -2,12 +2,11 @@
Brick changelog
---------------
0.53
0.55
----
Package changes:
* Increased lower bound on `vty` dependency to 5.29.
* Permit builds with GHC 8.10 (thanks Joshua Chia)
Bug fixes:
* `customMain` now restores the initial terminal input state on
@ -15,12 +14,31 @@ Bug fixes:
`suspendAndResume` before program exit are no longer propagated to the
end user's terminal environment (which could lead to broken or garbled
terminal I/O).
* Fixed a bug in `vLimitPercent` where it did not defer to the right
size policy of the child (thanks Janek Spaderna)
* `str` and `txt` now display as many zero-width characters as possible.
Prior to this change they would count the number of displayable
characters and stop too early without looking for more zero-width
characters.
0.54
----
API changes:
* Exported `Brick.Widgets.FileBrowser.maybeSelectCurrentEntry` (thanks
Róman Joost)
Other changes:
* Added handlers for the `Home` and `End` keys to
`Brick.Widgets.Edit.handleEditorEvent` (thanks Róman Joost)
0.53
----
Package changes:
* Relaxed base bounds to allow building with GHC 8.10 (thanks Joshua
Chia)
Bug fixes:
* `vLimitPercent`: use correct horizontal size policy from child
(thanks Janek Spaderna)
* `str`: be more aggressive in determining how many characters to
display (attempt to display as many zero-width characters as
possible)
0.52.1
------

View File

@ -62,6 +62,7 @@ at these projects:
* [`sudoku-tui`](https://github.com/evanrelf/sudoku-tui), a Sudoku implementation
* [`summoner-tui`](https://github.com/kowainik/summoner/tree/master/summoner-tui), an interactive frontend to the Summoner tool
* [`wrapping-editor`](https://github.com/ta0kira/wrapping-editor), an embeddable editor with support for Brick
* [`git-brunch`](https://github.com/andys8/git-brunch), a git branch checkout utility
These third-party packages also extend `brick`:

View File

@ -1,5 +1,5 @@
name: brick
version: 0.53
version: 0.55
synopsis: A declarative terminal user interface library
description:
Write terminal user interfaces (TUIs) painlessly with 'brick'! You

View File

@ -242,7 +242,7 @@ takeColumns numCols (c:cs) =
-- | Make a widget from a string, but wrap the words in the input's
-- lines at the available width using the default wrapping settings. The
-- input string should not contain escapes.
-- input string should not contain escape sequences or carriage returns.
--
-- Unlike 'str', this is greedy horizontally.
strWrap :: String -> Widget n
@ -250,7 +250,8 @@ strWrap = strWrapWith defaultWrapSettings
-- | Make a widget from a string, but wrap the words in the input's
-- lines at the available width using the specified wrapping settings.
-- The input string should not contain escapes.
-- The input string should not contain escape sequences or carriage
-- returns.
--
-- Unlike 'str', this is greedy horizontally.
strWrapWith :: WrapSettings -> String -> Widget n
@ -261,7 +262,7 @@ safeTextWidth = V.safeWcswidth . T.unpack
-- | Make a widget from text, but wrap the words in the input's lines at
-- the available width using the default wrapping settings. The input
-- text should not contain escapes.
-- text should not contain escape sequences or carriage returns.
--
-- Unlike 'txt', this is greedy horizontally.
txtWrap :: T.Text -> Widget n
@ -269,7 +270,7 @@ txtWrap = txtWrapWith defaultWrapSettings
-- | Make a widget from text, but wrap the words in the input's lines at
-- the available width using the specified wrapping settings. The input
-- text should not contain escapes.
-- text should not contain escape sequences or carriage returns.
--
-- Unlike 'txt', this is greedy horizontally.
txtWrapWith :: WrapSettings -> T.Text -> Widget n
@ -296,7 +297,7 @@ txtWrapWith settings s =
-- interface corruption will result since the terminal will likely
-- render it as taking up more than a single column. The caller should
-- replace tabs with the appropriate number of spaces as desired. The
-- reinput string should not contain escapes.
-- input string should not contain escape sequences or carriage returns.
str :: String -> Widget n
str s =
Widget Fixed Fixed $ do
@ -322,7 +323,7 @@ str s =
-- interface corruption will result since the terminal will likely
-- render it as taking up more than a single column. The caller should
-- replace tabs with the appropriate number of spaces as desired. The
-- reinput text should not contain escapes.
-- input text should not contain escape sequences or carriage returns.
txt :: T.Text -> Widget n
txt = str . T.unpack

View File

@ -124,6 +124,8 @@ handleEditorEvent e ed =
EvKey KLeft [] -> Z.moveLeft
EvKey KRight [] -> Z.moveRight
EvKey KBS [] -> Z.deletePrevChar
EvKey KHome [] -> Z.gotoBOL
EvKey KEnd [] -> Z.gotoEOL
_ -> id
in return $ applyEdit f ed

View File

@ -67,6 +67,7 @@ module Brick.Widgets.FileBrowser
-- * Handling events
, handleFileBrowserEvent
, maybeSelectCurrentEntry
-- * Rendering
, renderFileBrowser
@ -631,6 +632,12 @@ handleFileBrowserEventCommon e b =
_ ->
handleEventLensed b fileBrowserEntriesL handleListEvent e
-- | If the browser's current entry is selectable according to
-- @fileBrowserSelectable@, add it to the selection set and return.
-- If not, and if the entry is a directory or a symlink targeting a
-- directory, set the browser's current path to the selected directory.
--
-- Otherwise, return the browser state unchanged.
maybeSelectCurrentEntry :: FileBrowser n -> EventM n (FileBrowser n)
maybeSelectCurrentEntry b =
case fileBrowserCursor b of