mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 15:14:49 +03:00
ui: accounts: E key toggles --empty
This commit is contained in:
parent
399d61df53
commit
e3a55a72d9
@ -138,6 +138,7 @@ drawAccountsScreen AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
||||
-- ("up/down/pgup/pgdown/home/end", "move")
|
||||
("-=1234567890", "depth")
|
||||
,("F", "flat?")
|
||||
,("E", "empty?")
|
||||
,("C", "cleared?")
|
||||
,("R", "real?")
|
||||
,("right/enter", "register")
|
||||
@ -255,6 +256,7 @@ handleAccountsScreen st@AppState{
|
||||
Vty.EvKey (Vty.KChar '9') [] -> continue $ reload j d $ setDepth 9 st'
|
||||
Vty.EvKey (Vty.KChar '0') [] -> continue $ reload j d $ setDepth 0 st'
|
||||
Vty.EvKey (Vty.KChar 'F') [] -> continue $ reload j d $ stToggleFlat st'
|
||||
Vty.EvKey (Vty.KChar 'E') [] -> continue $ reload j d $ stToggleEmpty st'
|
||||
Vty.EvKey (Vty.KChar 'C') [] -> continue $ reload j d $ stToggleCleared st'
|
||||
Vty.EvKey (Vty.KChar 'R') [] -> continue $ reload j d $ stToggleReal st'
|
||||
Vty.EvKey (Vty.KLeft) [] -> continue $ popScreen st'
|
||||
|
@ -16,6 +16,7 @@ module Hledger.UI.UIUtils (
|
||||
,borderKeysStr
|
||||
--
|
||||
,stToggleCleared
|
||||
,stToggleEmpty
|
||||
,stToggleFlat
|
||||
,stToggleReal
|
||||
) where
|
||||
@ -49,6 +50,14 @@ stToggleCleared st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts
|
||||
toggleCleared :: ReportOpts -> ReportOpts
|
||||
toggleCleared ropts = ropts{cleared_=not $ cleared_ ropts}
|
||||
|
||||
stToggleEmpty :: AppState -> AppState
|
||||
stToggleEmpty st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
||||
st{aopts=uopts{cliopts_=copts{reportopts_=toggleEmpty ropts}}}
|
||||
|
||||
-- | Toggle between showing all and showing only empty items.
|
||||
toggleEmpty :: ReportOpts -> ReportOpts
|
||||
toggleEmpty ropts = ropts{empty_=not $ empty_ ropts}
|
||||
|
||||
stToggleFlat :: AppState -> AppState
|
||||
stToggleFlat st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
||||
st{aopts=uopts{cliopts_=copts{reportopts_=toggleFlatMode ropts}}}
|
||||
|
Loading…
Reference in New Issue
Block a user