brick 2.2 → 2.3
raw patch · 3 files changed
+24/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Brick.Forms: ShowCompositeField :: FormFieldVisibilityMode
Files
- CHANGELOG.md +9/−0
- brick.cabal +1/−1
- src/Brick/Forms.hs +14/−4
CHANGELOG.md view
@@ -2,6 +2,15 @@ Brick changelog --------------- +2.3+---++API changes:+* `FormFieldVisibilityMode`'s `ShowAugmentedField` was renamed to+ `ShowCompositeField` to be clearer about what it does, and a new+ `ShowAugmentedField` constructor was added to support a mode where+ field augmentations applied with `@@=` are made visible as well.+ 2.2 ---
brick.cabal view
@@ -1,5 +1,5 @@ name: brick-version: 2.2+version: 2.3 synopsis: A declarative terminal user interface library description: Write terminal user interfaces (TUIs) painlessly with 'brick'! You
src/Brick/Forms.hs view
@@ -153,10 +153,13 @@ ShowFocusedFieldOnly -- ^ Make only the focused field's selected input visible. For -- composite fields this will not bring all options into view.- | ShowAugmentedField+ | ShowCompositeField -- ^ Make all inputs in the focused field visible. For composite -- fields this will bring all options into view as long as the -- viewport is large enough to show them all.+ | ShowAugmentedField+ -- ^ Like 'ShowCompositeField' but includes rendering augmentations+ -- applied with '@@='. deriving (Eq, Show) -- | A form field state accompanied by the fields that manipulate that@@ -728,11 +731,16 @@ -- other inputs in the same field collection (e.g. a set of radio -- buttons) will not be brought into view along with it. ----- * 'ShowAugmentedField' - in this mode, when a field receives focus,+-- * 'ShowCompositeField' - in this mode, when a field receives focus, -- all of the inputs in its collection (e.g. a set of radio buttons) -- are brought into view as long as the viewport is large enough to -- show them all. If it isn't, the viewport will show as many as space -- allows.+--+-- * 'ShowAugmentedField' - in this mode, when a field receives focus,+-- all of the inputs in its collection (e.g. a set of radio buttons)+-- and its rendering augmentations (as applied with '@@=') are brought+-- into view as long as the viewport is large enough to show them all. setFieldVisibilityMode :: (Eq n) => n -- ^ The name of the form field whose visibility mode is to be set.@@ -817,7 +825,7 @@ foc = case curFocus of Nothing -> False Just n -> n `elem` fieldNames- maybeVisible = if foc && visMode == ShowAugmentedField then visible else id+ maybeVisible = if foc && visMode == ShowCompositeField then visible else id renderFields [] = [] renderFields ((FormField n validate extValid renderField _):fs) = let maybeInvalid = if (isJust $ validate st) && extValid@@ -827,7 +835,9 @@ maybeFieldVisible = if fieldFoc && visMode == ShowFocusedFieldOnly then visible else id in (n, maybeFieldVisible $ maybeInvalid $ renderField fieldFoc st) : renderFields fs (fieldNames, renderedFields) = unzip $ renderFields fields- in helper $ maybeVisible $ concatFields renderedFields+ maybeHelperVisible =+ if visMode == ShowAugmentedField then visible else id+ in maybeHelperVisible $ helper $ maybeVisible $ concatFields renderedFields -- | Dispatch an event to the currently focused form field. This handles -- the following events in this order: