ui: 0 now limits depth to 0 instead of resetting it
This commit is contained in:
parent
dc6f39a859
commit
8b9f5e1cdf
@ -192,7 +192,7 @@ asDraw AppState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
|
|||||||
("h", "help")
|
("h", "help")
|
||||||
,("right", "register")
|
,("right", "register")
|
||||||
,("F", "flat?")
|
,("F", "flat?")
|
||||||
,("-+=1234567890", "depth")
|
,("-+0123456789", "depth")
|
||||||
--,("/", "filter")
|
--,("/", "filter")
|
||||||
--,("DEL", "unfilter")
|
--,("DEL", "unfilter")
|
||||||
--,("ESC", "cancel/top")
|
--,("ESC", "cancel/top")
|
||||||
@ -271,19 +271,19 @@ asHandle st'@AppState{
|
|||||||
Vty.EvKey k [] | k `elem` [Vty.KChar 'h', Vty.KChar '?'] -> continue $ setMode Help st
|
Vty.EvKey k [] | k `elem` [Vty.KChar 'h', Vty.KChar '?'] -> continue $ setMode Help st
|
||||||
Vty.EvKey (Vty.KChar 'g') [] -> liftIO (stReloadJournalIfChanged copts d j st) >>= continue
|
Vty.EvKey (Vty.KChar 'g') [] -> liftIO (stReloadJournalIfChanged copts d j st) >>= continue
|
||||||
Vty.EvKey (Vty.KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> stReloadJournalIfChanged copts d j st
|
Vty.EvKey (Vty.KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> stReloadJournalIfChanged copts d j st
|
||||||
|
Vty.EvKey (Vty.KChar '0') [] -> continue $ regenerateScreens j d $ setDepth (Just 0) st
|
||||||
|
Vty.EvKey (Vty.KChar '1') [] -> continue $ regenerateScreens j d $ setDepth (Just 1) st
|
||||||
|
Vty.EvKey (Vty.KChar '2') [] -> continue $ regenerateScreens j d $ setDepth (Just 2) st
|
||||||
|
Vty.EvKey (Vty.KChar '3') [] -> continue $ regenerateScreens j d $ setDepth (Just 3) st
|
||||||
|
Vty.EvKey (Vty.KChar '4') [] -> continue $ regenerateScreens j d $ setDepth (Just 4) st
|
||||||
|
Vty.EvKey (Vty.KChar '5') [] -> continue $ regenerateScreens j d $ setDepth (Just 5) st
|
||||||
|
Vty.EvKey (Vty.KChar '6') [] -> continue $ regenerateScreens j d $ setDepth (Just 6) st
|
||||||
|
Vty.EvKey (Vty.KChar '7') [] -> continue $ regenerateScreens j d $ setDepth (Just 7) st
|
||||||
|
Vty.EvKey (Vty.KChar '8') [] -> continue $ regenerateScreens j d $ setDepth (Just 8) st
|
||||||
|
Vty.EvKey (Vty.KChar '9') [] -> continue $ regenerateScreens j d $ setDepth (Just 9) st
|
||||||
Vty.EvKey (Vty.KChar '-') [] -> continue $ regenerateScreens j d $ decDepth st
|
Vty.EvKey (Vty.KChar '-') [] -> continue $ regenerateScreens j d $ decDepth st
|
||||||
Vty.EvKey (Vty.KChar '+') [] -> continue $ regenerateScreens j d $ incDepth st
|
Vty.EvKey (Vty.KChar '_') [] -> continue $ regenerateScreens j d $ decDepth st
|
||||||
Vty.EvKey (Vty.KChar '=') [] -> continue $ regenerateScreens j d $ incDepth st
|
Vty.EvKey k [] | k `elem` [Vty.KChar '+', Vty.KChar '='] -> continue $ regenerateScreens j d $ incDepth st
|
||||||
Vty.EvKey (Vty.KChar '1') [] -> continue $ regenerateScreens j d $ setDepth 1 st
|
|
||||||
Vty.EvKey (Vty.KChar '2') [] -> continue $ regenerateScreens j d $ setDepth 2 st
|
|
||||||
Vty.EvKey (Vty.KChar '3') [] -> continue $ regenerateScreens j d $ setDepth 3 st
|
|
||||||
Vty.EvKey (Vty.KChar '4') [] -> continue $ regenerateScreens j d $ setDepth 4 st
|
|
||||||
Vty.EvKey (Vty.KChar '5') [] -> continue $ regenerateScreens j d $ setDepth 5 st
|
|
||||||
Vty.EvKey (Vty.KChar '6') [] -> continue $ regenerateScreens j d $ setDepth 6 st
|
|
||||||
Vty.EvKey (Vty.KChar '7') [] -> continue $ regenerateScreens j d $ setDepth 7 st
|
|
||||||
Vty.EvKey (Vty.KChar '8') [] -> continue $ regenerateScreens j d $ setDepth 8 st
|
|
||||||
Vty.EvKey (Vty.KChar '9') [] -> continue $ regenerateScreens j d $ setDepth 9 st
|
|
||||||
Vty.EvKey (Vty.KChar '0') [] -> continue $ regenerateScreens j d $ setDepth 0 st
|
|
||||||
Vty.EvKey (Vty.KChar 'F') [] -> continue $ regenerateScreens j d $ stToggleFlat st
|
Vty.EvKey (Vty.KChar 'F') [] -> continue $ regenerateScreens j d $ stToggleFlat st
|
||||||
Vty.EvKey (Vty.KChar 'E') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleEmpty st)
|
Vty.EvKey (Vty.KChar 'E') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleEmpty st)
|
||||||
Vty.EvKey (Vty.KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleCleared st)
|
Vty.EvKey (Vty.KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ stToggleCleared st)
|
||||||
|
|||||||
@ -113,8 +113,8 @@ stResetFilter st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=
|
|||||||
,query_=""
|
,query_=""
|
||||||
}}}}
|
}}}}
|
||||||
|
|
||||||
stResetDepth :: AppState -> AppState
|
resetDepth :: AppState -> AppState
|
||||||
stResetDepth st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
resetDepth st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
||||||
st{aopts=uopts{cliopts_=copts{reportopts_=ropts{depth_=Nothing}}}}
|
st{aopts=uopts{cliopts_=copts{reportopts_=ropts{depth_=Nothing}}}}
|
||||||
|
|
||||||
-- | Get the maximum account depth in the current journal.
|
-- | Get the maximum account depth in the current journal.
|
||||||
@ -139,20 +139,19 @@ incDepth st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts
|
|||||||
inc (Just d) | d < (maxDepth st - 1) = Just $ d+1
|
inc (Just d) | d < (maxDepth st - 1) = Just $ d+1
|
||||||
inc _ = Nothing
|
inc _ = Nothing
|
||||||
|
|
||||||
-- | Set the current depth limit to the specified depth, which should
|
-- | Set the current depth limit to the specified depth, or remove the depth limit.
|
||||||
-- be a positive number. If it is zero, or equal to or greater than the
|
-- Also remove the depth limit if the specified depth is greater than the current
|
||||||
-- current maximum account depth, the depth limit will be removed.
|
-- maximum account depth. If the specified depth is negative, reset the depth limit
|
||||||
-- (Slight inconsistency here: zero is currently a valid display depth
|
-- to whatever was specified at startup.
|
||||||
-- which can be reached using the - key. But we need a key to remove
|
setDepth :: Maybe Int -> AppState -> AppState
|
||||||
-- the depth limit, and 0 is it.)
|
setDepth mdepth st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}}
|
||||||
setDepth :: Int -> AppState -> AppState
|
|
||||||
setDepth depth st@AppState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}}
|
|
||||||
= st{aopts=uopts{cliopts_=copts{reportopts_=ropts{depth_=mdepth'}}}}
|
= st{aopts=uopts{cliopts_=copts{reportopts_=ropts{depth_=mdepth'}}}}
|
||||||
where
|
where
|
||||||
mdepth' | depth < 0 = depth_ ropts
|
mdepth' = case mdepth of
|
||||||
| depth == 0 = Nothing
|
Nothing -> Nothing
|
||||||
| depth >= maxDepth st = Nothing
|
Just d | d < 0 -> depth_ ropts
|
||||||
| otherwise = Just depth
|
| d >= maxDepth st -> Nothing
|
||||||
|
| otherwise -> mdepth
|
||||||
|
|
||||||
-- | Open the minibuffer, setting its content to the current query with the cursor at the end.
|
-- | Open the minibuffer, setting its content to the current query with the cursor at the end.
|
||||||
stShowMinibuffer st = setMode (Minibuffer e) st
|
stShowMinibuffer st = setMode (Minibuffer e) st
|
||||||
@ -192,7 +191,7 @@ popScreen st = st
|
|||||||
|
|
||||||
resetScreens :: Day -> AppState -> AppState
|
resetScreens :: Day -> AppState -> AppState
|
||||||
resetScreens d st@AppState{aScreen=s,aPrevScreens=ss} =
|
resetScreens d st@AppState{aScreen=s,aPrevScreens=ss} =
|
||||||
(sInit topscreen) d True $ stResetDepth $ stResetFilter $ stCloseMinibuffer st{aScreen=topscreen, aPrevScreens=[]}
|
(sInit topscreen) d True $ resetDepth $ stResetFilter $ stCloseMinibuffer st{aScreen=topscreen, aPrevScreens=[]}
|
||||||
where
|
where
|
||||||
topscreen = case ss of _:_ -> last ss
|
topscreen = case ss of _:_ -> last ss
|
||||||
[] -> s
|
[] -> s
|
||||||
@ -243,8 +242,8 @@ helpDialog =
|
|||||||
,str " "
|
,str " "
|
||||||
,str "accounts screen:"
|
,str "accounts screen:"
|
||||||
,renderKey ("F", "toggle flat mode")
|
,renderKey ("F", "toggle flat mode")
|
||||||
,renderKey ("-+=1234567890", "")
|
,renderKey ("-+0123456789", "")
|
||||||
,str " adjust/set/remove depth limit"
|
,str " adjust/set depth limit"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|||||||
@ -267,9 +267,10 @@ When not in flat mode, indentation indicates the account hierarchy.
|
|||||||
By default, all subaccounts are displayed.
|
By default, all subaccounts are displayed.
|
||||||
To see less detail, set a depth limit by pressing a number key,
|
To see less detail, set a depth limit by pressing a number key,
|
||||||
\f[C]1\f[] to \f[C]9\f[].
|
\f[C]1\f[] to \f[C]9\f[].
|
||||||
Or, adjust the depth limit by pressing \f[C]\-\f[] or \f[C]+\f[]
|
\f[C]0\f[] shows even less detail, collapsing all accounts to a single
|
||||||
(\f[C]=\f[] also works).
|
total.
|
||||||
\f[C]0\f[] removes the depth limit.
|
\f[C]\-\f[] and \f[C]+\f[] decrease and increase the depth limit.
|
||||||
|
To remove the depth limit press \f[C]=\f[], or just keep increasing it.
|
||||||
.PP
|
.PP
|
||||||
\f[C]C\f[] toggles cleared mode, in which uncleared transactions and
|
\f[C]C\f[] toggles cleared mode, in which uncleared transactions and
|
||||||
postings are not shown.
|
postings are not shown.
|
||||||
|
|||||||
@ -212,9 +212,10 @@ matched transactions.
|
|||||||
`F' toggles flat mode on and off.
|
`F' toggles flat mode on and off.
|
||||||
|
|
||||||
By default, all subaccounts are displayed. To see less detail, set a
|
By default, all subaccounts are displayed. To see less detail, set a
|
||||||
depth limit by pressing a number key, `1' to `9'. Or, adjust the depth
|
depth limit by pressing a number key, `1' to `9'. `0' shows even less
|
||||||
limit by pressing `-' or `+' (`=' also works). `0' removes the depth
|
detail, collapsing all accounts to a single total. `-' and `+'
|
||||||
limit.
|
decrease and increase the depth limit. To remove the depth limit press
|
||||||
|
`=', or just keep increasing it.
|
||||||
|
|
||||||
`C' toggles cleared mode, in which uncleared transactions and
|
`C' toggles cleared mode, in which uncleared transactions and
|
||||||
postings are not shown. `U' toggles uncleared mode, in which only
|
postings are not shown. `U' toggles uncleared mode, in which only
|
||||||
@ -330,11 +331,11 @@ Node: SCREENS5098
|
|||||||
Ref: #screens5185
|
Ref: #screens5185
|
||||||
Node: Accounts screen5275
|
Node: Accounts screen5275
|
||||||
Ref: #accounts-screen5405
|
Ref: #accounts-screen5405
|
||||||
Node: Register screen6509
|
Node: Register screen6599
|
||||||
Ref: #register-screen6666
|
Ref: #register-screen6756
|
||||||
Node: Transaction screen8419
|
Node: Transaction screen8509
|
||||||
Ref: #transaction-screen8579
|
Ref: #transaction-screen8669
|
||||||
Node: Error screen9446
|
Node: Error screen9536
|
||||||
Ref: #error-screen9570
|
Ref: #error-screen9660
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|||||||
@ -118,8 +118,9 @@ When not in flat mode, indentation indicates the account hierarchy. `F` toggles
|
|||||||
|
|
||||||
By default, all subaccounts are displayed.
|
By default, all subaccounts are displayed.
|
||||||
To see less detail, set a depth limit by pressing a number key, `1` to `9`.
|
To see less detail, set a depth limit by pressing a number key, `1` to `9`.
|
||||||
Or, adjust the depth limit by pressing `-` or `+` (`=` also works).
|
`0` shows even less detail, collapsing all accounts to a single total.
|
||||||
`0` removes the depth limit.
|
`-` and `+` (or `=`) decrease and increase the depth limit.
|
||||||
|
To remove the depth limit, set it higher than the maximum account depth, or press `ESCAPE`.
|
||||||
|
|
||||||
`C` toggles cleared mode, in which
|
`C` toggles cleared mode, in which
|
||||||
[uncleared transactions and postings](/journal.html#transactions) are
|
[uncleared transactions and postings](/journal.html#transactions) are
|
||||||
|
|||||||
@ -183,8 +183,10 @@ SSCCRREEEENNSS
|
|||||||
toggles flat mode on and off.
|
toggles flat mode on and off.
|
||||||
|
|
||||||
By default, all subaccounts are displayed. To see less detail, set a
|
By default, all subaccounts are displayed. To see less detail, set a
|
||||||
depth limit by pressing a number key, 1 to 9. Or, adjust the depth
|
depth limit by pressing a number key, 1 to 9. 0 shows even less
|
||||||
limit by pressing - or + (= also works). 0 removes the depth limit.
|
detail, collapsing all accounts to a single total. - and + decrease
|
||||||
|
and increase the depth limit. To remove the depth limit press =, or
|
||||||
|
just keep increasing it.
|
||||||
|
|
||||||
C toggles cleared mode, in which uncleared transactions and postings
|
C toggles cleared mode, in which uncleared transactions and postings
|
||||||
are not shown. U toggles uncleared mode, in which only uncleared
|
are not shown. U toggles uncleared mode, in which only uncleared
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user