mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-24 08:43:41 +03:00
Compare commits
4 Commits
1cc1845ee3
...
743fd2726b
Author | SHA1 | Date | |
---|---|---|---|
|
743fd2726b | ||
|
bbd7250123 | ||
|
d1121320bc | ||
|
ea04c60681 |
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"@.
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user