From ffe8b4752947d7f2a782ae07ca16d18ed8dc9ba0 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Tue, 27 Jun 2017 21:47:54 +0800 Subject: [PATCH] Update brick to 0.19 --- hledger-ui/Hledger/UI/UIState.hs | 7 +++++++ hledger-ui/Hledger/UI/UIUtils.hs | 5 +++++ hledger-ui/hledger-ui.cabal | 2 +- hledger-ui/package.yaml | 2 +- stack-ghc7.10.yaml | 3 ++- stack.yaml | 4 +++- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/hledger-ui/Hledger/UI/UIState.hs b/hledger-ui/Hledger/UI/UIState.hs index 1968d9783..00d731526 100644 --- a/hledger-ui/Hledger/UI/UIState.hs +++ b/hledger-ui/Hledger/UI/UIState.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {- | UIState operations. -} {-# LANGUAGE OverloadedStrings #-} @@ -6,7 +7,9 @@ module Hledger.UI.UIState where +#if !MIN_VERSION_brick(0,19,0) import Brick +#endif import Brick.Widgets.Edit import Data.List import Data.Text.Zipper (gotoEOL) @@ -235,7 +238,11 @@ getDepth UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}} = depth_ rop showMinibuffer :: UIState -> UIState showMinibuffer ui = setMode (Minibuffer e) ui 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 +#endif oldq = query_ $ reportopts_ $ cliopts_ $ aopts ui -- | Close the minibuffer, discarding any edit in progress. diff --git a/hledger-ui/Hledger/UI/UIUtils.hs b/hledger-ui/Hledger/UI/UIUtils.hs index b42582df2..d5ee4f4ad 100644 --- a/hledger-ui/Hledger/UI/UIUtils.hs +++ b/hledger-ui/Hledger/UI/UIUtils.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {- | Rendering & misc. helpers. -} {-# LANGUAGE OverloadedStrings #-} @@ -139,7 +140,11 @@ minibuffer :: Editor String Name -> Widget Name minibuffer ed = forceAttr (borderAttr <> "minibuffer") $ hBox $ +#if MIN_VERSION_brick(0,19,0) + [txt "filter: ", renderEditor (str . unlines) True ed] +#else [txt "filter: ", renderEditor True ed] +#endif -- | Wrap a widget in the default hledger-ui screen layout. defaultLayout :: Widget Name -> Widget Name -> Widget Name -> Widget Name diff --git a/hledger-ui/hledger-ui.cabal b/hledger-ui/hledger-ui.cabal index 0fc50b92f..0048d24b1 100644 --- a/hledger-ui/hledger-ui.cabal +++ b/hledger-ui/hledger-ui.cabal @@ -85,7 +85,7 @@ executable hledger-ui buildable: False else build-depends: - brick >= 0.12 && < 0.19 + brick >= 0.12 && < 0.20 , vty >= 5.5 && < 5.16 if flag(threaded) ghc-options: -threaded diff --git a/hledger-ui/package.yaml b/hledger-ui/package.yaml index 0f61f5454..49954b190 100644 --- a/hledger-ui/package.yaml +++ b/hledger-ui/package.yaml @@ -88,7 +88,7 @@ executables: buildable: false else: dependencies: - - brick >= 0.12 && < 0.19 + - brick >= 0.12 && < 0.20 - vty >= 5.5 && < 5.16 - condition: flag(threaded) ghc-options: -threaded diff --git a/stack-ghc7.10.yaml b/stack-ghc7.10.yaml index 63c8e5ca3..bb668988e 100644 --- a/stack-ghc7.10.yaml +++ b/stack-ghc7.10.yaml @@ -10,7 +10,8 @@ packages: - hledger-api extra-deps: -- brick-0.13 +- brick-0.19 +- data-clist-0.1.1.0 - text-zipper-0.8.1 - vty-5.11.3 - megaparsec-5.1.2 diff --git a/stack.yaml b/stack.yaml index bc68d48a6..6b9e6ca8f 100644 --- a/stack.yaml +++ b/stack.yaml @@ -10,4 +10,6 @@ packages: - hledger-web - hledger-api -extra-deps: [] +extra-deps: +- brick-0.19 +- data-clist-0.1.1.0