Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-brick for openSUSE:Factory 
checked in at 2024-01-10 21:51:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-brick (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-brick.new.21961 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-brick"

Wed Jan 10 21:51:12 2024 rev:27 rq:1137770 version:2.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-brick/ghc-brick.changes      2023-11-23 
21:43:07.844977726 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-brick.new.21961/ghc-brick.changes   
2024-01-10 21:51:31.590506581 +0100
@@ -1,0 +2,47 @@
+Mon Dec 18 00:44:39 UTC 2023 - Peter Simons <[email protected]>
+
+- Update brick to version 2.2.
+  2.2
+  ---
+
+  Enhancements:
+  * `Brick.Forms` got a new `FormFieldVisibilityMode` type and a
+    `setFieldVisibilityMode` function to allow greater control over
+    how form field collections are brought into view when forms are
+    rendered in viewports. Form fields will default to using the
+    `ShowFocusedFieldOnly` mode which preserves functionality prior to
+    this release. To get the new behavior, set a field's visibility mode
+    to `ShowAugmentedField`.
+
+  2.1.1
+  -----
+
+  Bug fixes:
+  * `defaultMain` now properly shuts down Vty before it returns, fixing
+    a bug where the terminal would be in an unclean state on return from
+    `defaultMain`.
+
+  2.1
+  ---
+
+  API changes:
+
+  * Added `Brick.Main.customMainWithDefaultVty` as an alternative way to
+    initialize Brick.
+
+  2.0
+  ---
+
+  This release updates Brick to support Vty 6, which includes support for
+  Windows.
+
+  Package changes:
+  * Increased lower bound on `vty` to 6.0.
+  * Added dependency on `vty-crossplatform`.
+  * Migrated from `unix` dependency to `unix-compat`.
+
+  Other changes:
+  * Update core library and demo programs to use `vty-crossplatform` to
+    initialize the terminal.
+
+-------------------------------------------------------------------

Old:
----
  brick-1.10.tar.gz
  brick.cabal

New:
----
  brick-2.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-brick.spec ++++++
--- /var/tmp/diff_new_pack.ArufYQ/_old  2024-01-10 21:51:32.558541735 +0100
+++ /var/tmp/diff_new_pack.ArufYQ/_new  2024-01-10 21:51:32.558541735 +0100
@@ -20,13 +20,12 @@
 %global pkgver %{pkg_name}-%{version}
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        1.10
+Version:        2.2
 Release:        0
 Summary:        A declarative terminal user interface library
 License:        BSD-3-Clause
 URL:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-Source1:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-base-devel
 BuildRequires:  ghc-base-prof
@@ -65,10 +64,12 @@
 BuildRequires:  ghc-text-prof
 BuildRequires:  ghc-text-zipper-devel
 BuildRequires:  ghc-text-zipper-prof
-BuildRequires:  ghc-unix-devel
-BuildRequires:  ghc-unix-prof
+BuildRequires:  ghc-unix-compat-devel
+BuildRequires:  ghc-unix-compat-prof
 BuildRequires:  ghc-vector-devel
 BuildRequires:  ghc-vector-prof
+BuildRequires:  ghc-vty-crossplatform-devel
+BuildRequires:  ghc-vty-crossplatform-prof
 BuildRequires:  ghc-vty-devel
 BuildRequires:  ghc-vty-prof
 BuildRequires:  ghc-word-wrap-devel
@@ -125,7 +126,6 @@
 
 %prep
 %autosetup -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
 
 %build
 %ghc_lib_build

++++++ brick-1.10.tar.gz -> brick-2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/CHANGELOG.md new/brick-2.2/CHANGELOG.md
--- old/brick-1.10/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/CHANGELOG.md  2001-09-09 03:46:40.000000000 +0200
@@ -2,6 +2,49 @@
 Brick changelog
 ---------------
 
+2.2
+---
+
+Enhancements:
+* `Brick.Forms` got a new `FormFieldVisibilityMode` type and a
+  `setFieldVisibilityMode` function to allow greater control over
+  how form field collections are brought into view when forms are
+  rendered in viewports. Form fields will default to using the
+  `ShowFocusedFieldOnly` mode which preserves functionality prior to
+  this release. To get the new behavior, set a field's visibility mode
+  to `ShowAugmentedField`.
+
+2.1.1
+-----
+
+Bug fixes:
+* `defaultMain` now properly shuts down Vty before it returns, fixing
+  a bug where the terminal would be in an unclean state on return from
+  `defaultMain`.
+
+2.1
+---
+
+API changes:
+
+* Added `Brick.Main.customMainWithDefaultVty` as an alternative way to
+  initialize Brick.
+
+2.0
+---
+
+This release updates Brick to support Vty 6, which includes support for
+Windows.
+
+Package changes:
+* Increased lower bound on `vty` to 6.0.
+* Added dependency on `vty-crossplatform`.
+* Migrated from `unix` dependency to `unix-compat`.
+
+Other changes:
+* Update core library and demo programs to use `vty-crossplatform` to
+  initialize the terminal.
+
 1.10
 ----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/README.md new/brick-2.2/README.md
--- old/brick-1.10/README.md    2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/README.md     2001-09-09 03:46:40.000000000 +0200
@@ -13,7 +13,9 @@
 
 Under the hood, this library builds upon
 [vty](http://hackage.haskell.org/package/vty), so some knowledge of Vty
-will be necessary to use this library.
+will be necessary to use this library. Brick depends on
+`vty-crossplatform`, so Brick should work anywhere Vty works (Unix and
+Windows). Brick releases prior to 2.0 only support Unix-based systems.
 
 Example
 -------
@@ -95,6 +97,7 @@
 | [`Giter`](https://gitlab.com/refaelsh/giter) | A UI wrapper around Git CLI 
inspired by [Magit](https://magit.vc/). |
 | [`Brickudoku`](https://github.com/Thecentury/brickudoku) | A hybrid of 
Tetris and Sudoku |
 | [`timeloop`](https://github.com/cdupont/timeloop) | A time-travelling 
demonstrator |
+| 
[`brick-trading-journal`](https://codeberg.org/amano.kenji/brick-trading-journal)
 | A TUI program that calculates basic statistics from trades |
 
 These third-party packages also extend `brick`:
 
@@ -179,14 +182,24 @@
 packages and widgets. If you use that, you'll also be helping to test
 whether the exported interface is usable and complete!
 
+A note on Windows support
+-------------------------
+
+Brick supports Windows implicitly by way of Vty's Windows support.
+While I don't (and can't) personally test Brick on Windows hosts,
+it should be possible to use Brick on Windows. If you have any
+trouble, report any issues here. If needed, we'll migrate them to the
+[vty-windows](https://github.com/chhackett/vty-windows) repository if
+they need to be fixed there.
+
 Reporting bugs
 --------------
 
 Please file bug reports as GitHub issues.  For best results:
 
  - Include the versions of relevant software packages: your terminal
-   emulator, `brick`, `ghc`, and `vty` will be the most important
-   ones.
+   emulator, `brick`, `ghc`, `vty`, and Vty platform packages will be
+   the most important ones.
 
  - Clearly describe the behavior you expected ...
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/brick.cabal new/brick-2.2/brick.cabal
--- old/brick-1.10/brick.cabal  2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/brick.cabal   2001-09-09 03:46:40.000000000 +0200
@@ -1,5 +1,5 @@
 name:                brick
-version:             1.10
+version:             2.2
 synopsis:            A declarative terminal user interface library
 description:
   Write terminal user interfaces (TUIs) painlessly with 'brick'! You
@@ -94,8 +94,9 @@
     Brick.Types.Internal
     Brick.Widgets.Internal
 
-  build-depends:       base >= 4.9.0.0 && < 4.19.0.0,
-                       vty >= 5.36,
+  build-depends:       base >= 4.9.0.0 && < 4.21.0.0,
+                       vty >= 6.0,
+                       vty-crossplatform,
                        bimap >= 0.5 && < 0.6,
                        data-clist >= 0.1,
                        directory >= 1.2.5.0,
@@ -112,8 +113,8 @@
                        text,
                        text-zipper >= 0.13,
                        template-haskell,
-                       deepseq >= 1.3 && < 1.5,
-                       unix,
+                       deepseq >= 1.3 && < 1.6,
+                       unix-compat,
                        bytestring,
                        word-wrap >= 0.2
 
@@ -159,6 +160,7 @@
                        brick,
                        text,
                        vty,
+                       vty-crossplatform,
                        random,
                        microlens-th,
                        microlens-mtl
@@ -202,6 +204,7 @@
                        text,
                        microlens,
                        microlens-th,
+                       vty-crossplatform,
                        vty
 
 executable brick-text-wrap-demo
@@ -259,6 +262,7 @@
   build-depends:       base,
                        brick,
                        vty,
+                       vty-crossplatform,
                        text,
                        microlens,
                        microlens-mtl,
@@ -571,4 +575,5 @@
                        microlens,
                        vector,
                        vty,
+                       vty-crossplatform,
                        QuickCheck
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/docs/guide.rst 
new/brick-2.2/docs/guide.rst
--- old/brick-1.10/docs/guide.rst       2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/docs/guide.rst        2001-09-09 03:46:40.000000000 +0200
@@ -53,6 +53,13 @@
    $ cd brick
    $ cabal new-build
 
+Your package will need some dependencies:
+
+* ``brick``,
+* ``vty >= 6.0``, and
+* ``vty-crossplatform`` or ``vty-unix`` or ``vty-windows``, depending
+  on which platform(s) your application supports.
+
 Building the Demonstration Programs
 -----------------------------------
 
@@ -291,7 +298,7 @@
 
 .. code:: haskell
 
-   data MyState = MyState { _editor :: Editor Text n }
+   data MyState n = MyState { _editor :: Editor Text n }
    makeLenses ''MyState
 
 This declares the ``MyState`` type with an ``Editor`` contained within
@@ -403,7 +410,7 @@
    main :: IO ()
    main = do
        eventChan <- Brick.BChan.newBChan 10
-       let buildVty = Graphics.Vty.mkVty Graphics.Vty.defaultConfig
+       let buildVty = Graphics.Vty.CrossPlatform.mkVty 
Graphics.Vty.Config.defaultConfig
        initialVty <- buildVty
        finalState <- customMain initialVty buildVty
                        (Just eventChan) app initialState
@@ -412,7 +419,11 @@
 The ``customMain`` function lets us have control over how the ``vty``
 library is initialized *and* how ``brick`` gets custom events to give to
 our event handler. ``customMain`` is the entry point into ``brick`` when
-you need to use your own event type as shown here.
+you need to use your own event type as shown here. In this example we're
+using ``mkVty`` provided by the ``vty-crossplatform`` package, which
+provides build-time support for both Unix and Windows. If you prefer,
+you can use either the ``vty-unix`` package or the ``vty-windows``
+package directly instead if you only want to support one platform.
 
 With all of this in place, sending our custom events to the event
 handler is straightforward:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/programs/CustomEventDemo.hs 
new/brick-2.2/programs/CustomEventDemo.hs
--- old/brick-1.10/programs/CustomEventDemo.hs  2001-09-09 03:46:40.000000000 
+0200
+++ new/brick-2.2/programs/CustomEventDemo.hs   2001-09-09 03:46:40.000000000 
+0200
@@ -17,7 +17,7 @@
 import Brick.Main
   ( App(..)
   , showFirstCursor
-  , customMain
+  , customMainWithDefaultVty
   , halt
   )
 import Brick.AttrMap
@@ -82,6 +82,4 @@
         writeBChan chan Counter
         threadDelay 1000000
 
-    let buildVty = V.mkVty V.defaultConfig
-    initialVty <- buildVty
-    void $ customMain initialVty buildVty (Just chan) theApp initialState
+    void $ customMainWithDefaultVty (Just chan) theApp initialState
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/programs/FormDemo.hs 
new/brick-2.2/programs/FormDemo.hs
--- old/brick-1.10/programs/FormDemo.hs 2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/programs/FormDemo.hs  2001-09-09 03:46:40.000000000 +0200
@@ -11,6 +11,8 @@
 #endif
 
 import qualified Graphics.Vty as V
+import Graphics.Vty.CrossPlatform (mkVty)
+
 import Brick
 import Brick.Forms
   ( Form
@@ -136,7 +138,7 @@
 main :: IO ()
 main = do
     let buildVty = do
-          v <- V.mkVty =<< V.standardIOConfig
+          v <- mkVty V.defaultConfig
           V.setMode (V.outputIface v) V.Mouse True
           return v
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/programs/TailDemo.hs 
new/brick-2.2/programs/TailDemo.hs
--- old/brick-1.10/programs/TailDemo.hs 2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/programs/TailDemo.hs  2001-09-09 03:46:40.000000000 +0200
@@ -142,11 +142,9 @@
 
 main :: IO ()
 main = do
-    cfg <- V.standardIOConfig
-    vty <- V.mkVty cfg
     chan <- newBChan 10
 
     -- Run thread to simulate incoming data
     void $ forkIO $ generateLines chan
 
-    void $ customMain vty (V.mkVty cfg) (Just chan) app initialState
+    void $ customMainWithDefaultVty (Just chan) app initialState
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/programs/ViewportScrollbarsDemo.hs 
new/brick-2.2/programs/ViewportScrollbarsDemo.hs
--- old/brick-1.10/programs/ViewportScrollbarsDemo.hs   2001-09-09 
03:46:40.000000000 +0200
+++ new/brick-2.2/programs/ViewportScrollbarsDemo.hs    2001-09-09 
03:46:40.000000000 +0200
@@ -10,6 +10,7 @@
 import Data.Monoid ((<>))
 #endif
 import qualified Graphics.Vty as V
+import Graphics.Vty.CrossPlatform (mkVty)
 
 import qualified Brick.Types as T
 import qualified Brick.Main as M
@@ -167,7 +168,7 @@
 main :: IO ()
 main = do
     let buildVty = do
-          v <- V.mkVty =<< V.standardIOConfig
+          v <- mkVty V.defaultConfig
           V.setMode (V.outputIface v) V.Mouse True
           return v
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/src/Brick/Forms.hs 
new/brick-2.2/src/Brick/Forms.hs
--- old/brick-1.10/src/Brick/Forms.hs   2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/src/Brick/Forms.hs    2001-09-09 03:46:40.000000000 +0200
@@ -49,6 +49,7 @@
     Form
   , FormFieldState(..)
   , FormField(..)
+  , FormFieldVisibilityMode(..)
 
   -- * Creating and using forms
   , newForm
@@ -65,6 +66,7 @@
   , setFieldConcat
   , setFormFocus
   , updateFormState
+  , setFieldVisibilityMode
 
   -- * Simple form field constructors
   , editTextField
@@ -145,6 +147,18 @@
               -- ^ An event handler for this field.
               }
 
+-- | How to bring form fields into view when a form is rendered in a
+-- viewport with 'viewport'.
+data FormFieldVisibilityMode =
+    ShowFocusedFieldOnly
+    -- ^ Make only the focused field's selected input visible. For
+    -- composite fields this will not bring all options into view.
+    | ShowAugmentedField
+    -- ^ 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.
+    deriving (Eq, Show)
+
 -- | A form field state accompanied by the fields that manipulate that
 -- state. The idea is that some record field in your form state has
 -- one or more form fields that manipulate that value. This data type
@@ -189,6 +203,9 @@
                       , formFieldConcat :: [Widget n] -> Widget n
                       -- ^ Concatenation function for this field's input
                       -- renderings.
+                      , formFieldVisibilityMode :: FormFieldVisibilityMode
+                      -- ^ This field's visibility mode for use in
+                      -- viewports.
                       } -> FormFieldState s e n
 
 -- | A form: a sequence of input fields that manipulate the fields of an
@@ -250,8 +267,8 @@
 updateFormState :: s -> Form s e n -> Form s e n
 updateFormState newState f =
     let updateField fs = case fs of
-            FormFieldState st l upd s rh concatAll ->
-                FormFieldState (upd (newState^.l) st) l upd s rh concatAll
+            FormFieldState st l upd s rh concatAll visMode ->
+                FormFieldState (upd (newState^.l) st) l upd s rh concatAll 
visMode
     in f { formState = newState
          , formFieldStates = updateField <$> formFieldStates f
          }
@@ -287,7 +304,7 @@
             }
 
 formFieldNames :: FormFieldState s e n -> [n]
-formFieldNames (FormFieldState _ _ _ fields _ _) = formFieldName <$> fields
+formFieldNames (FormFieldState _ _ _ fields _ _ _) = formFieldName <$> fields
 
 -- | A form field for manipulating a boolean value. This represents
 -- 'True' as @[X] label@ and 'False' as @[ ] label@.
@@ -345,6 +362,7 @@
                           \val _ -> val
                       , formFieldRenderHelper = id
                       , formFieldConcat = vBox
+                      , formFieldVisibilityMode = ShowFocusedFieldOnly
                       }
 
 renderCheckbox :: (Ord n) => Char -> Char -> Char -> T.Text -> n -> Bool -> 
Bool -> Widget n
@@ -406,7 +424,9 @@
                                Just (_, e) -> listMoveToElement e l
                       , formFieldRenderHelper = id
                       , formFieldConcat = vBox
+                      , formFieldVisibilityMode = ShowFocusedFieldOnly
                       }
+
 -- | A form field for selecting a single choice from a set of possible
 -- choices. Each choice has an associated value and text label.
 --
@@ -474,6 +494,7 @@
                       , formFieldUpdate = \val _ -> val
                       , formFieldRenderHelper = id
                       , formFieldConcat = vBox
+                      , formFieldVisibilityMode = ShowFocusedFieldOnly
                       }
 
 renderRadio :: (Eq a, Ord n) => Char -> Char -> Char -> a -> n -> T.Text -> 
Bool -> a -> Widget n
@@ -548,6 +569,7 @@
                              else applyEdit (Z.insertMany newTxt . 
Z.clearZipper) e
                       , formFieldRenderHelper = id
                       , formFieldConcat = vBox
+                      , formFieldVisibilityMode = ShowFocusedFieldOnly
                       }
 
 -- | A form field using a single-line editor to edit the 'Show'
@@ -691,6 +713,46 @@
 invalidFields :: Form s e n -> [n]
 invalidFields f = concatMap getInvalidFields (formFieldStates f)
 
+-- | Set the visibility mode of the specified form field's collection
+-- when the form is rendered in viewport. This is used to change how
+-- focused fields are brought into view when they're outside of view
+-- in a viewport and gain focus. In practice, this means this function
+-- need only be called on one form field name in a collection in order
+-- to affect the visibility behavior of that field's entire input
+-- collection.
+--
+-- There are two visibility modes:
+--
+-- * 'ShowFocusedFieldOnly' - this is the default behavior. In this
+--   mode, when a field receives focus, it is brought into view but
+--   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,
+--   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.
+setFieldVisibilityMode :: (Eq n)
+                       => n
+                       -- ^ The name of the form field whose visibility mode 
is to be set.
+                       -> FormFieldVisibilityMode
+                       -- ^ The mode to set.
+                       -> Form s e n
+                       -- ^ The form to modify.
+                       -> Form s e n
+setFieldVisibilityMode n mode form =
+    let go1 [] = []
+        go1 (s:ss) =
+            let s' = case s of
+                       FormFieldState st l upd fs rh concatAll _ ->
+                           if n `elem` formFieldNames s
+                           then FormFieldState st l upd fs rh concatAll mode
+                           else s
+            in s' : go1 ss
+
+    in form { formFieldStates = go1 (formFieldStates form) }
+
 -- | Manually indicate that a field has invalid contents. This can be
 -- useful in situations where validation beyond the form element's
 -- validator needs to be performed and the result of that validation
@@ -707,18 +769,18 @@
     let go1 [] = []
         go1 (s:ss) =
             let s' = case s of
-                       FormFieldState st l upd fs rh concatAll ->
+                       FormFieldState st l upd fs rh concatAll visMode ->
                            let go2 [] = []
                                go2 (f@(FormField fn val _ r h):ff)
                                    | n == fn = FormField fn val v r h : ff
                                    | otherwise = f : go2 ff
-                           in FormFieldState st l upd (go2 fs) rh concatAll
+                           in FormFieldState st l upd (go2 fs) rh concatAll 
visMode
             in s' : go1 ss
 
     in form { formFieldStates = go1 (formFieldStates form) }
 
 getInvalidFields :: FormFieldState s e n -> [n]
-getInvalidFields (FormFieldState st _ _ fs _ _) =
+getInvalidFields (FormFieldState st _ _ fs _ _ _) =
     let gather (FormField n validate extValid _ _) =
             if not extValid || isNothing (validate st) then [n] else []
     in concatMap gather fs
@@ -750,16 +812,22 @@
                      => FocusRing n
                      -> FormFieldState s e n
                      -> Widget n
-renderFormFieldState fr (FormFieldState st _ _ fields helper concatFields) =
-    let renderFields [] = []
+renderFormFieldState fr (FormFieldState st _ _ fields helper concatFields 
visMode) =
+    let curFocus = focusGetCurrent fr
+        foc = case curFocus of
+                  Nothing -> False
+                  Just n -> n `elem` fieldNames
+        maybeVisible = if foc && visMode == ShowAugmentedField then visible 
else id
+        renderFields [] = []
         renderFields ((FormField n validate extValid renderField _):fs) =
             let maybeInvalid = if (isJust $ validate st) && extValid
                                then id
                                else forceAttr invalidFormInputAttr
-                foc = Just n == focusGetCurrent fr
-                maybeVisible = if foc then visible else id
-            in (maybeVisible $ maybeInvalid $ renderField foc st) : 
renderFields fs
-    in helper $ concatFields $ renderFields fields
+                fieldFoc = Just n == curFocus
+                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
 
 -- | Dispatch an event to the currently focused form field. This handles
 -- the following events in this order:
@@ -835,7 +903,10 @@
         i' = if i == 0 then length as - 1 else i - 1
     in as !! i'
 
-withFocusAndGrouping :: (Eq n) => BrickEvent n e -> (n -> [n] -> EventM n 
(Form s e n) ()) -> EventM n (Form s e n) ()
+withFocusAndGrouping :: (Eq n)
+                     => BrickEvent n e
+                     -> (n -> [n] -> EventM n (Form s e n) ())
+                     -> EventM n (Form s e n) ()
 withFocusAndGrouping e act = do
     foc <- gets formFocus
     case focusGetCurrent foc of
@@ -862,7 +933,7 @@
     let findFieldState _ [] = return ()
         findFieldState prev (e:es) =
             case e of
-                FormFieldState st stLens upd fields helper concatAll -> do
+                FormFieldState st stLens upd fields helper concatAll visMode 
-> do
                     let findField [] = return Nothing
                         findField (field:rest) =
                             case field of
@@ -879,7 +950,7 @@
                     case result of
                         Nothing -> findFieldState (prev <> [e]) es
                         Just (newSt, maybeSt) -> do
-                            let newFieldState = FormFieldState newSt stLens 
upd fields helper concatAll
+                            let newFieldState = FormFieldState newSt stLens 
upd fields helper concatAll visMode
                             formFieldStatesL .= prev <> [newFieldState] <> es
                             case maybeSt of
                               Nothing -> return ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/src/Brick/Main.hs 
new/brick-2.2/src/Brick/Main.hs
--- old/brick-1.10/src/Brick/Main.hs    2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/src/Brick/Main.hs     2001-09-09 03:46:40.000000000 +0200
@@ -5,6 +5,7 @@
   , defaultMain
   , customMain
   , customMainWithVty
+  , customMainWithDefaultVty
   , simpleMain
   , resizeOrQuit
   , simpleApp
@@ -73,11 +74,11 @@
   , displayBounds
   , shutdown
   , nextEvent
-  , mkVty
-  , defaultConfig
   , restoreInputState
   , inputIface
   )
+import Graphics.Vty.CrossPlatform (mkVty)
+import Graphics.Vty.Config (defaultConfig)
 import Graphics.Vty.Attributes (defAttr)
 
 import Brick.BChan (BChan, newBChan, readBChan, readBChan2, writeBChan)
@@ -122,8 +123,8 @@
         }
 
 -- | The default main entry point which takes an application and an
--- initial state and returns the final state returned by a 'halt'
--- operation.
+-- initial state and returns the final state from 'EventM' once the
+-- program exits.
 defaultMain :: (Ord n)
             => App s e n
             -- ^ The application.
@@ -131,9 +132,9 @@
             -- ^ The initial application state.
             -> IO s
 defaultMain app st = do
-    let builder = mkVty defaultConfig
-    initialVty <- builder
-    customMain initialVty builder Nothing app st
+    (s, vty) <- customMainWithDefaultVty Nothing app st
+    shutdown vty
+    return s
 
 -- | A simple main entry point which takes a widget and renders it. This
 -- event loop terminates when the user presses any key, but terminal
@@ -235,6 +236,25 @@
     restoreInitialState
     return s
 
+-- | Like 'customMainWithVty', except that Vty is initialized with the
+-- default configuration.
+customMainWithDefaultVty :: (Ord n)
+                         => Maybe (BChan e)
+                         -- ^ An event channel for sending custom
+                         -- events to the event loop (you write to this
+                         -- channel, the event loop reads from it).
+                         -- Provide 'Nothing' if you don't plan on
+                         -- sending custom events.
+                         -> App s e n
+                         -- ^ The application.
+                         -> s
+                         -- ^ The initial application state.
+                         -> IO (s, Vty)
+customMainWithDefaultVty mUserChan app initialAppState = do
+    let builder = mkVty defaultConfig
+    vty <- builder
+    customMainWithVty vty builder mUserChan app initialAppState
+
 -- | Like 'customMain', except the last 'Vty' handle used by the
 -- application is returned without being shut down with 'shutdown'. This
 -- allows the caller to re-use the 'Vty' handle for something else, such
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/src/Brick/Widgets/FileBrowser.hs 
new/brick-2.2/src/Brick/Widgets/FileBrowser.hs
--- old/brick-1.10/src/Brick/Widgets/FileBrowser.hs     2001-09-09 
03:46:40.000000000 +0200
+++ new/brick-2.2/src/Brick/Widgets/FileBrowser.hs      2001-09-09 
03:46:40.000000000 +0200
@@ -162,8 +162,8 @@
 import Lens.Micro.TH (lensRules, generateUpdateableOptics)
 import qualified Graphics.Vty as Vty
 import qualified System.Directory as D
-import qualified System.Posix.Files as U
-import qualified System.Posix.Types as U
+import qualified System.PosixCompat.Files as U
+import qualified System.PosixCompat.Types as U
 import qualified System.FilePath as FP
 import Text.Printf (printf)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/tests/Main.hs new/brick-2.2/tests/Main.hs
--- old/brick-1.10/tests/Main.hs        2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/tests/Main.hs 2001-09-09 03:46:40.000000000 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE TypeOperators #-}
 {-# LANGUAGE TemplateHaskell #-}
 {-# LANGUAGE TypeFamilies #-}
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/brick-1.10/tests/Render.hs 
new/brick-2.2/tests/Render.hs
--- old/brick-1.10/tests/Render.hs      2001-09-09 03:46:40.000000000 +0200
+++ new/brick-2.2/tests/Render.hs       2001-09-09 03:46:40.000000000 +0200
@@ -10,6 +10,7 @@
 import Data.Monoid
 #endif
 import qualified Graphics.Vty as V
+import qualified Graphics.Vty.CrossPlatform.Testing as V
 import Brick.Widgets.Border (hBorder)
 import Control.Exception (SomeException, try)
 
@@ -18,7 +19,7 @@
 
 renderDisplay :: Ord n => [Widget n] -> IO ()
 renderDisplay ws = do
-    outp <- V.outputForConfig V.defaultConfig
+    outp <- V.mkDefaultOutput
     ctx <- V.displayContext outp region
     V.outputPicture ctx (renderWidget Nothing ws region)
     V.releaseDisplay outp

Reply via email to