From dde2ea7e42bc76f984d4ba10805f3747d7f6e2b2 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sun, 10 Jul 2022 22:03:45 +0100 Subject: [PATCH] pkg: ui: support doclayout 0.4, brick 0.72+ --- hledger-ui/Hledger/UI/AccountsScreen.hs | 12 ++++++++++-- hledger-ui/Hledger/UI/RegisterScreen.hs | 12 ++++++++++-- hledger-ui/hledger-ui.cabal | 2 +- hledger-ui/package.yaml | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/hledger-ui/Hledger/UI/AccountsScreen.hs b/hledger-ui/Hledger/UI/AccountsScreen.hs index 0d9d21e0d..e5fcc815f 100644 --- a/hledger-ui/Hledger/UI/AccountsScreen.hs +++ b/hledger-ui/Hledger/UI/AccountsScreen.hs @@ -1,5 +1,6 @@ -- The accounts screen, showing accounts and balances like the CLI balance command. +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} @@ -254,8 +255,15 @@ asHandle ui0@UIState{ where s = chomp $ unlines $ map strip $ getEditContents ed VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui - VtyEvent ev -> do ed' <- handleEditorEvent ev ed - continue $ ui{aMode=Minibuffer "filter" ed'} + VtyEvent ev -> do + ed' <- handleEditorEvent +#if MIN_VERSION_brick(0,72,0) + (VtyEvent ev) +#else + ev +#endif + ed + continue $ ui{aMode=Minibuffer "filter" ed'} AppEvent _ -> continue ui MouseDown{} -> continue ui MouseUp{} -> continue ui diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index 7a13e6327..62cf22e15 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -1,5 +1,6 @@ -- The account register screen, showing transactions in an account, like hledger-web's register. +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} @@ -302,8 +303,15 @@ rsHandle ui@UIState{ -- VtyEvent (EvKey (KChar '/') []) -> continue $ regenerateScreens j d $ showMinibuffer ui VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui - VtyEvent ev -> do ed' <- handleEditorEvent ev ed - continue $ ui{aMode=Minibuffer "filter" ed'} + VtyEvent ev -> do + ed' <- handleEditorEvent +#if MIN_VERSION_brick(0,72,0) + (VtyEvent ev) +#else + ev +#endif + ed + continue $ ui{aMode=Minibuffer "filter" ed'} AppEvent _ -> continue ui MouseDown{} -> continue ui MouseUp{} -> continue ui diff --git a/hledger-ui/hledger-ui.cabal b/hledger-ui/hledger-ui.cabal index ef01ed6df..4e80b8d72 100644 --- a/hledger-ui/hledger-ui.cabal +++ b/hledger-ui/hledger-ui.cabal @@ -73,7 +73,7 @@ executable hledger-ui , containers >=0.5.9 , data-default , directory - , doclayout ==0.3.* + , doclayout >=0.3 && <0.5 , extra >=1.6.3 , filepath , fsnotify >=0.2.1.2 && <0.4 diff --git a/hledger-ui/package.yaml b/hledger-ui/package.yaml index fe166271e..8bc5a2402 100644 --- a/hledger-ui/package.yaml +++ b/hledger-ui/package.yaml @@ -59,7 +59,7 @@ dependencies: - containers >=0.5.9 - data-default - directory -- doclayout >=0.3 && <0.4 +- doclayout >=0.3 && <0.5 - extra >=1.6.3 - filepath - fsnotify >=0.2.1.2 && <0.4