Compare commits

...

4 Commits

Author SHA1 Message Date
Jonathan Daugherty
743fd2726b More editing nits 2023-05-07 22:10:02 -07:00
Jonathan Daugherty
bbd7250123 Editing nit 2023-05-07 22:07:11 -07:00
Jonathan Daugherty
d1121320bc Nit 2023-05-07 22:01:27 -07:00
Jonathan Daugherty
ea04c60681 Brick.Forms: clarify how attributes get used 2023-05-07 18:52:18 -07:00
3 changed files with 33 additions and 10 deletions

View File

@ -1649,8 +1649,8 @@ step-by-step process for using it, in the module documentation for
``Brick.Keybindings.KeyDispatcher``.
The following table compares Brick application design decisions and
runtime behaviors in a typical application compared to one that uses the
customizable keybindings API:
runtime behaviors in a typical application to those of an application
that uses the customizable keybindings API:
+---------------------+------------------------+-------------------------+
| **Approach** | **Before runtime** | **At runtime** |
@ -1745,12 +1745,12 @@ to two events. Whether that's a problem depends entirely on how
open and only handled ``QuitEvent`` when the window had been closed.
This kind of "modal" approach to handling events means that we only
consider a key to have a collision if it is bound to two or more
events that are handled in the same event handler.
events that are handled in the same event handling context.
There's also another situation that would be problematic, which is when
an abstract event like ``QuitEvent`` has a key mapping that
There's also another situation that would be problematic, which is
when an abstract event like ``QuitEvent`` has a key mapping that
collides with a key handler that is bound to a specific key using
``Brick.Keybindings.KeyDispatcher.onKey`` rather than an event:
``Brick.Keybindings.KeyDispatcher.onKey`` rather than an abstract event:
.. code:: haskell

View File

@ -359,6 +359,9 @@ renderCheckbox lb check rb label n foc val =
-- | A form field for selecting a single choice from a set of possible
-- choices in a scrollable list. This uses a 'List' internally.
--
-- This field's attributes are governed by those exported from
-- 'Brick.Widgets.List'.
--
-- This field responds to the same input events that a 'List' does.
listField :: forall s e n a . (Ord n, Show n, Eq a)
=> (s -> Vector a)
@ -492,6 +495,9 @@ renderRadio lb check rb val name label foc cur =
-- a value. The other editing fields in this module are special cases of
-- this function.
--
-- This field's attributes are governed by those exported from
-- 'Brick.Widgets.Edit'.
--
-- This field responds to all events handled by 'editor', including
-- mouse events.
editField :: (Ord n, Show n)
@ -550,6 +556,9 @@ editField stLens n limit ini val renderText wrapEditor initialState =
-- useful in cases where the user-facing representation of a value
-- matches the 'Show' representation exactly, such as with 'Int'.
--
-- This field's attributes are governed by those exported from
-- 'Brick.Widgets.Edit'.
--
-- This field responds to all events handled by 'editor', including
-- mouse events.
editShowableField :: (Ord n, Show n, Read a, Show a)
@ -570,6 +579,9 @@ editShowableField stLens n =
-- user-facing representation of a value matches the 'Show' representation
-- exactly, such as with 'Int', but you don't want to accept just /any/ 'Int'.
--
-- This field's attributes are governed by those exported from
-- 'Brick.Widgets.Edit'.
--
-- This field responds to all events handled by 'editor', including
-- mouse events.
editShowableFieldWithValidate :: (Ord n, Show n, Read a, Show a)
@ -598,6 +610,9 @@ editShowableFieldWithValidate stLens n isValid =
-- | A form field using an editor to edit a text value. Since the value
-- is free-form text, it is always valid.
--
-- This field's attributes are governed by those exported from
-- 'Brick.Widgets.Edit'.
--
-- This field responds to all events handled by 'editor', including
-- mouse events.
editTextField :: (Ord n, Show n)
@ -620,6 +635,9 @@ editTextField stLens n limit =
-- value represented as a password. The value is always considered valid
-- and is always represented with one asterisk per password character.
--
-- This field's attributes are governed by those exported from
-- 'Brick.Widgets.Edit'.
--
-- This field responds to all events handled by 'editor', including
-- mouse events.
editPasswordField :: (Ord n, Show n)
@ -644,11 +662,18 @@ toPassword s = txt $ T.replicate (T.length $ T.concat s) "*"
formAttr :: AttrName
formAttr = attrName "brickForm"
-- | The attribute for form input fields with invalid values.
-- | The attribute for form input fields with invalid values. Note that
-- this attribute will affect any field considered invalid and will take
-- priority over any attributes that the field uses to render itself.
invalidFormInputAttr :: AttrName
invalidFormInputAttr = formAttr <> attrName "invalidInput"
-- | The attribute for form input fields that have the focus.
-- | The attribute for form input fields that have the focus. Note that
-- this attribute only affects fields that do not already use their own
-- attributes when rendering, such as editor- and list-based fields.
-- Those need to be styled by setting the appropriate attributes; see
-- the documentation for field constructors to find out which attributes
-- need to be configured.
focusedFormInputAttr :: AttrName
focusedFormInputAttr = formAttr <> attrName "focusedInput"

View File

@ -6,8 +6,6 @@
-- | Support for representing attribute themes and loading and saving
-- theme customizations in INI-style files.
--
-- The file format is as follows:
--
-- Customization files are INI-style files with two sections, both
-- optional: @"default"@ and @"other"@.
--