ui: allow multiple status filters to be active at once (#564)
This commit is contained in:
parent
dcc58d4a2b
commit
22e751983b
@ -15,6 +15,7 @@ module Hledger.Reports.ReportOptions (
|
|||||||
checkReportOpts,
|
checkReportOpts,
|
||||||
flat_,
|
flat_,
|
||||||
tree_,
|
tree_,
|
||||||
|
reportOptsToggleStatus,
|
||||||
whichDateFromOpts,
|
whichDateFromOpts,
|
||||||
journalSelectingAmountFromOpts,
|
journalSelectingAmountFromOpts,
|
||||||
queryFromOpts,
|
queryFromOpts,
|
||||||
@ -284,6 +285,11 @@ simplifyStatuses l
|
|||||||
l' = nub $ sort l
|
l' = nub $ sort l
|
||||||
numstatuses = length [minBound .. maxBound :: Status]
|
numstatuses = length [minBound .. maxBound :: Status]
|
||||||
|
|
||||||
|
-- | Add/remove this status from the status list. Used by hledger-ui.
|
||||||
|
reportOptsToggleStatus s ropts@ReportOpts{statuses_=ss}
|
||||||
|
| s `elem` ss = ropts{statuses_=filter (/= s) ss}
|
||||||
|
| otherwise = ropts{statuses_=simplifyStatuses (s:ss)}
|
||||||
|
|
||||||
type DisplayExp = String
|
type DisplayExp = String
|
||||||
|
|
||||||
maybedisplayopt :: Day -> RawOpts -> Maybe DisplayExp
|
maybedisplayopt :: Day -> RawOpts -> Maybe DisplayExp
|
||||||
|
|||||||
@ -32,10 +32,6 @@ toggleCleared :: UIState -> UIState
|
|||||||
toggleCleared ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
toggleCleared ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
||||||
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Cleared ropts}}}
|
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatus Cleared ropts}}}
|
||||||
|
|
||||||
reportOptsToggleStatus s ropts
|
|
||||||
| clearedstatus_ ropts == [s] = ropts{clearedstatus_=[]}
|
|
||||||
| otherwise = ropts{clearedstatus_=[s]}
|
|
||||||
|
|
||||||
-- | Toggle between showing all and showing only nonempty (more precisely, nonzero) items.
|
-- | Toggle between showing all and showing only nonempty (more precisely, nonzero) items.
|
||||||
toggleEmpty :: UIState -> UIState
|
toggleEmpty :: UIState -> UIState
|
||||||
toggleEmpty ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
toggleEmpty ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
|
||||||
|
|||||||
@ -76,9 +76,9 @@ helpDialog =
|
|||||||
,renderKey ("t", "set report period to today")
|
,renderKey ("t", "set report period to today")
|
||||||
,str " "
|
,str " "
|
||||||
,renderKey ("/", "set a filter query")
|
,renderKey ("/", "set a filter query")
|
||||||
,renderKey ("U", "toggle unmarked/all")
|
,renderKey ("U", "toggle unmarked filter")
|
||||||
,renderKey ("P", "toggle pending/all")
|
,renderKey ("P", "toggle pending filter")
|
||||||
,renderKey ("C", "toggle cleared/all")
|
,renderKey ("C", "toggle cleared filter")
|
||||||
,renderKey ("R", "toggle real/all")
|
,renderKey ("R", "toggle real/all")
|
||||||
,renderKey ("Z", "toggle nonzero/all")
|
,renderKey ("Z", "toggle nonzero/all")
|
||||||
,renderKey ("DEL/BS", "remove filters")
|
,renderKey ("DEL/BS", "remove filters")
|
||||||
|
|||||||
@ -163,9 +163,13 @@ balances are what you would see on a bank statement for that account (unless dis
|
|||||||
a filter query). Period balances ignore transactions before the report start date, so they
|
a filter query). Period balances ignore transactions before the report start date, so they
|
||||||
show the change in balance during the report period. They are more useful eg when viewing a time log.
|
show the change in balance during the report period. They are more useful eg when viewing a time log.
|
||||||
|
|
||||||
`C` toggles cleared mode, which shows balances for postings with [cleared status](/journal.html#status) only.
|
`U` toggles filtering by [unmarked status](/journal.html#status),
|
||||||
Similarly, `P` toggles pending mode, which shows balances for pending postings only,
|
including or excluding unmarked postings in the balances.
|
||||||
and `U` toggles uncleared mode, which shows balances for unmarked postings only.
|
Similarly, `P` toggles pending postings,
|
||||||
|
and `C` toggles cleared postings.
|
||||||
|
(By default, balances include all postings;
|
||||||
|
if you activate one or two status filters, only those postings are included;
|
||||||
|
and if you activate all three, the filter is removed.)
|
||||||
|
|
||||||
`R` toggles real mode, in which [virtual postings](/journal.html#virtual-postings) are ignored.
|
`R` toggles real mode, in which [virtual postings](/journal.html#virtual-postings) are ignored.
|
||||||
|
|
||||||
@ -202,9 +206,11 @@ In other words, the register always shows the transactions responsible for the p
|
|||||||
shown on the accounts screen.
|
shown on the accounts screen.
|
||||||
As on the accounts screen, this can be toggled with `F`.
|
As on the accounts screen, this can be toggled with `F`.
|
||||||
|
|
||||||
`C` toggles cleared mode, which shows transactions with [cleared status](/journal.html#status) only.
|
`U` toggles filtering by [unmarked status](/journal.html#status), showing or hiding unmarked transactions.
|
||||||
Similarly, `P` toggles pending mode, which shows only pending transactions,
|
Similarly, `P` toggles pending transactions, and `C` toggles cleared transactions.
|
||||||
and `U` toggles uncleared mode, which shows only unmarked transactions.
|
(By default, transactions with all statuses are shown;
|
||||||
|
if you activate one or two status filters, only those transactions are shown;
|
||||||
|
and if you activate all three, the filter is removed.)q
|
||||||
|
|
||||||
`R` toggles real mode, in which [virtual postings](/journal.html#virtual-postings) are ignored.
|
`R` toggles real mode, in which [virtual postings](/journal.html#virtual-postings) are ignored.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user