Update brick to 0.19

This commit is contained in:
Felix Yan 2017-06-27 21:47:54 +08:00 committed by Simon Michael
parent 28c420109d
commit ffe8b47529
6 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{- | UIState operations. -} {- | UIState operations. -}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
@ -6,7 +7,9 @@
module Hledger.UI.UIState module Hledger.UI.UIState
where where
#if !MIN_VERSION_brick(0,19,0)
import Brick import Brick
#endif
import Brick.Widgets.Edit import Brick.Widgets.Edit
import Data.List import Data.List
import Data.Text.Zipper (gotoEOL) import Data.Text.Zipper (gotoEOL)
@ -235,7 +238,11 @@ getDepth UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}} = depth_ rop
showMinibuffer :: UIState -> UIState showMinibuffer :: UIState -> UIState
showMinibuffer ui = setMode (Minibuffer e) ui showMinibuffer ui = setMode (Minibuffer e) ui
where where
#if MIN_VERSION_brick(0,19,0)
e = applyEdit gotoEOL $ editor MinibufferEditor (Just 1) oldq
#else
e = applyEdit gotoEOL $ editor MinibufferEditor (str . unlines) (Just 1) oldq e = applyEdit gotoEOL $ editor MinibufferEditor (str . unlines) (Just 1) oldq
#endif
oldq = query_ $ reportopts_ $ cliopts_ $ aopts ui oldq = query_ $ reportopts_ $ cliopts_ $ aopts ui
-- | Close the minibuffer, discarding any edit in progress. -- | Close the minibuffer, discarding any edit in progress.

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{- | Rendering & misc. helpers. -} {- | Rendering & misc. helpers. -}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
@ -139,7 +140,11 @@ minibuffer :: Editor String Name -> Widget Name
minibuffer ed = minibuffer ed =
forceAttr (borderAttr <> "minibuffer") $ forceAttr (borderAttr <> "minibuffer") $
hBox $ hBox $
#if MIN_VERSION_brick(0,19,0)
[txt "filter: ", renderEditor (str . unlines) True ed]
#else
[txt "filter: ", renderEditor True ed] [txt "filter: ", renderEditor True ed]
#endif
-- | Wrap a widget in the default hledger-ui screen layout. -- | Wrap a widget in the default hledger-ui screen layout.
defaultLayout :: Widget Name -> Widget Name -> Widget Name -> Widget Name defaultLayout :: Widget Name -> Widget Name -> Widget Name -> Widget Name

View File

@ -85,7 +85,7 @@ executable hledger-ui
buildable: False buildable: False
else else
build-depends: build-depends:
brick >= 0.12 && < 0.19 brick >= 0.12 && < 0.20
, vty >= 5.5 && < 5.16 , vty >= 5.5 && < 5.16
if flag(threaded) if flag(threaded)
ghc-options: -threaded ghc-options: -threaded

View File

@ -88,7 +88,7 @@ executables:
buildable: false buildable: false
else: else:
dependencies: dependencies:
- brick >= 0.12 && < 0.19 - brick >= 0.12 && < 0.20
- vty >= 5.5 && < 5.16 - vty >= 5.5 && < 5.16
- condition: flag(threaded) - condition: flag(threaded)
ghc-options: -threaded ghc-options: -threaded

View File

@ -10,7 +10,8 @@ packages:
- hledger-api - hledger-api
extra-deps: extra-deps:
- brick-0.13 - brick-0.19
- data-clist-0.1.1.0
- text-zipper-0.8.1 - text-zipper-0.8.1
- vty-5.11.3 - vty-5.11.3
- megaparsec-5.1.2 - megaparsec-5.1.2

View File

@ -10,4 +10,6 @@ packages:
- hledger-web - hledger-web
- hledger-api - hledger-api
extra-deps: [] extra-deps:
- brick-0.19
- data-clist-0.1.1.0