pkg: ui: support doclayout 0.4, brick 0.72+

This commit is contained in:
Simon Michael 2022-07-10 22:03:45 +01:00
parent 6b42514dbc
commit dde2ea7e42
4 changed files with 22 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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