ui: escape key also clears report period limits

This commit is contained in:
Simon Michael 2020-07-17 15:48:15 -07:00
parent 847fc23236
commit bc62fcada4
2 changed files with 7 additions and 3 deletions

View File

@ -236,6 +236,10 @@ setReportPeriod :: Period -> UIState -> UIState
setReportPeriod p ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} = setReportPeriod p ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{period_=p}}}} ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{period_=p}}}}
-- | Clear any report period limits.
resetReportPeriod :: UIState -> UIState
resetReportPeriod = setReportPeriod PeriodAll
-- | Apply a new filter query. -- | Apply a new filter query.
setFilter :: String -> UIState -> UIState setFilter :: String -> UIState -> UIState
setFilter s ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} = setFilter s ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
@ -341,7 +345,7 @@ popScreen ui = ui
resetScreens :: Day -> UIState -> UIState resetScreens :: Day -> UIState -> UIState
resetScreens d ui@UIState{aScreen=s,aPrevScreens=ss} = resetScreens d ui@UIState{aScreen=s,aPrevScreens=ss} =
(sInit topscreen) d True $ resetDepth $ resetFilter $ closeMinibuffer ui{aScreen=topscreen, aPrevScreens=[]} (sInit topscreen) d True $ resetDepth $ resetReportPeriod $ resetFilter $ closeMinibuffer ui{aScreen=topscreen, aPrevScreens=[]}
where where
topscreen = case ss of _:_ -> last ss topscreen = case ss of _:_ -> last ss
[] -> s [] -> s

View File

@ -131,8 +131,8 @@ both ordinary transactions recorded in the journal, and periodic
transactions generated by rule. `f` toggles forecast mode, in which transactions generated by rule. `f` toggles forecast mode, in which
future/forecasted transactions are shown. *(experimental)* future/forecasted transactions are shown. *(experimental)*
`escape` removes all filters and jumps back to the top screen. `escape` removes all filters and report period limits and jumps back to the top screen.
or, it cancels a minibuffer edit or help dialog in progress. Or, it cancels minibuffer data entry or a help popup.
`ctrl-l` redraws the screen and centers the selection if possible `ctrl-l` redraws the screen and centers the selection if possible
(selections near the top won't be centered, since we don't scroll above the top). (selections near the top won't be centered, since we don't scroll above the top).