ui: flat mode affects register too; doc updates

This commit is contained in:
Simon Michael 2016-06-18 08:46:08 -07:00
parent c26178acdd
commit cc8180b295
8 changed files with 153 additions and 135 deletions

View File

@ -111,6 +111,7 @@ asDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
toplabel = files toplabel = files
<+> nonzero <+> nonzero
<+> str " accounts" <+> str " accounts"
<+> withAttr (borderAttr <> "query") (str (if flat_ ropts then " (flat)" else ""))
<+> borderQueryStr querystr <+> borderQueryStr querystr
<+> togglefilters <+> togglefilters
<+> borderDepthStr mdepth <+> borderDepthStr mdepth

View File

@ -48,21 +48,20 @@ rsSetAccount a scr@RegisterScreen{} = scr{rsAccount=replaceHiddenAccountsNameWit
rsSetAccount _ scr = scr rsSetAccount _ scr = scr
rsInit :: Day -> Bool -> UIState -> UIState rsInit :: Day -> Bool -> UIState -> UIState
rsInit d reset ui@UIState{aopts=opts, ajournal=j, aScreen=s@RegisterScreen{..}} = rsInit d reset ui@UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}, ajournal=j, aScreen=s@RegisterScreen{..}} =
ui{aScreen=s{rsList=newitems'}} ui{aScreen=s{rsList=newitems'}}
where where
-- gather arguments and queries -- gather arguments and queries
ropts = (reportopts_ $ cliopts_ opts) ropts' = ropts{
{ depth_=Nothing
depth_=Nothing, ,balancetype_=HistoricalBalance
balancetype_=HistoricalBalance
} }
-- XXX temp -- XXX temp
thisacctq = Acct $ accountNameToAccountRegex rsAccount -- includes subs thisacctq = Acct $ (if flat_ ropts then accountNameToAccountOnlyRegex else accountNameToAccountRegex) rsAccount
q = filterQuery (not . queryIsDepth) $ queryFromOpts d ropts q = filterQuery (not . queryIsDepth) $ queryFromOpts d ropts'
(_label,items) = accountTransactionsReport ropts j q thisacctq (_label,items) = accountTransactionsReport ropts' j q thisacctq
items' = (if empty_ ropts then id else filter (not . isZeroMixedAmount . fifth6)) $ -- without --empty, exclude no-change txns items' = (if empty_ ropts' then id else filter (not . isZeroMixedAmount . fifth6)) $ -- without --empty, exclude no-change txns
reverse -- most recent last reverse -- most recent last
items items
@ -107,7 +106,9 @@ rsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}}
-- Minibuffer e -> [minibuffer e, maincontent] -- Minibuffer e -> [minibuffer e, maincontent]
_ -> [maincontent] _ -> [maincontent]
where where
toplabel = withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount) toplabel =
withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount)
<+> withAttr (borderAttr <> "query") (str $ if flat_ ropts then " (exclusive)" else "")
<+> togglefilters <+> togglefilters
<+> str " transactions" <+> str " transactions"
<+> borderQueryStr (query_ ropts) <+> borderQueryStr (query_ ropts)
@ -247,6 +248,7 @@ rsHandle ui@UIState{
EvKey (KChar c) [] | c `elem` ['h','?'] -> continue $ setMode Help ui EvKey (KChar c) [] | c `elem` ['h','?'] -> continue $ setMode Help ui
EvKey (KChar 'g') [] -> liftIO (uiReloadJournalIfChanged copts d j ui) >>= continue EvKey (KChar 'g') [] -> liftIO (uiReloadJournalIfChanged copts d j ui) >>= continue
EvKey (KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> uiReloadJournalIfChanged copts d j ui EvKey (KChar 'a') [] -> suspendAndResume $ clearScreen >> setCursorPosition 0 0 >> add copts j >> uiReloadJournalIfChanged copts d j ui
EvKey (KChar 'F') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleFlat ui)
EvKey (KChar 'E') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleEmpty ui) EvKey (KChar 'E') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleEmpty ui)
EvKey (KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleCleared ui) EvKey (KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleCleared ui)
EvKey (KChar 'U') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleUncleared ui) EvKey (KChar 'U') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleUncleared ui)

View File

@ -65,11 +65,12 @@ 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}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{query_=s}}}} ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{query_=s}}}}
-- | Clear all filter queries/flags. -- | Clear all filters/flags.
resetFilter :: UIState -> UIState resetFilter :: UIState -> UIState
resetFilter ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} = resetFilter ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{ ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{
empty_=True accountlistmode_=ALTree
,empty_=True
,cleared_=False ,cleared_=False
,pending_=False ,pending_=False
,uncleared_=False ,uncleared_=False

View File

@ -41,23 +41,21 @@ helpDialog =
,str " move selection" ,str " move selection"
,renderKey ("RIGHT/ENTER", "drill down") ,renderKey ("RIGHT/ENTER", "drill down")
,renderKey ("LEFT", "previous screen") ,renderKey ("LEFT", "previous screen")
,renderKey ("ESC", "cancel / reset to top") ,renderKey ("ESC", "cancel / reset")
] ]
) )
,(padLeftRight 1 $ ,(padLeftRight 1 $
vBox [ vBox [
str "FILTERING" str "FILTERING"
,renderKey ("/", "set a filter query")
,renderKey ("DEL/BS", "remove filters")
,renderKey ("C", "toggle cleared filter") ,renderKey ("C", "toggle cleared filter")
,renderKey ("U", "toggle uncleared filter") ,renderKey ("U", "toggle uncleared filter")
,renderKey ("R", "toggle real filter") ,renderKey ("R", "toggle real filter")
,renderKey ("E", "toggle nonzero filter") ,renderKey ("E", "toggle nonzero filter")
,renderKey ("/", "set a filter query") ,renderKey ("F", "toggle flat/exclusive mode")
,renderKey ("DEL/BS", "remove filters")
,str " "
,str "accounts screen:" ,str "accounts screen:"
,renderKey ("F", "toggle flat mode") ,renderKey ("-+0123456789", "set depth limit")
,renderKey ("-+0123456789", "")
,str " adjust/set depth limit"
] ]
) )
] ]

View File

@ -261,10 +261,7 @@ By default, it shows all accounts and their latest ending balances.
if you specify a query on the command line, it shows just the matched if you specify a query on the command line, it shows just the matched
accounts and the balances from matched transactions. accounts and the balances from matched transactions.
.PP .PP
When not in flat mode, indentation indicates the account hierarchy. Account names are normally indented to show the hierarchy (tree mode).
\f[C]F\f[] toggles flat mode on and off.
.PP
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[].
\f[C]0\f[] shows even less detail, collapsing all accounts to a single \f[C]0\f[] shows even less detail, collapsing all accounts to a single
@ -274,6 +271,10 @@ depth limit.
To remove the depth limit, set it higher than the maximum account depth, To remove the depth limit, set it higher than the maximum account depth,
or press \f[C]ESCAPE\f[]. or press \f[C]ESCAPE\f[].
.PP .PP
\f[C]F\f[] toggles flat mode on and off.
In flat mode, accounts are listed without indentation (and account
registers will exclude subaccounts, see below).
.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.
\f[C]U\f[] toggles uncleared mode, in which only uncleared \f[C]U\f[] toggles uncleared mode, in which only uncleared
@ -289,25 +290,23 @@ Press \f[C]right\f[] or \f[C]enter\f[] to view an account\[aq]s
transactions register. transactions register.
.SS Register screen .SS Register screen
.PP .PP
This screen lists all transactions affecting a particular account, like This screen shows the transactions affecting a particular account, like
a check register. a check register.
Unlike hledger\[aq]s register command (which lists individual postings), Each line represents one transaction and shows:
in hledger\-ui\[aq]s register:
.IP \[bu] 2 .IP \[bu] 2
Each line represents a whole transaction. the other account(s) involved, in abbreviated form.
.IP \[bu] 2
For each transaction, it shows the other account(s) involved, in
abbreviated form.
(If there are both real and virtual postings, it shows only the accounts (If there are both real and virtual postings, it shows only the accounts
affected by real postings.) affected by real postings.)
.IP \[bu] 2 .IP \[bu] 2
It shows the overall change to the current account\[aq]s balance from the overall change to the current account\[aq]s balance; positive for an
each transaction; positive for an inflow to this account, negative for inflow to this account, negative for an outflow.
an outflow.
.IP \[bu] 2 .IP \[bu] 2
When no query other than a date limit is in effect, it shows the current the current account\[aq]s historic balance (if no query other than a
account\[aq]s historic balance as of the transaction date. date limit is in effect) or the running total starting from zero
Otherwise it shows a running total starting from zero. (otherwise), after the transaction.
.PD 0
.P
.PD
Eg, these will show historic balances: Eg, these will show historic balances:
.RS 2 .RS 2
.IP .IP
@ -331,6 +330,13 @@ $\ hledger\-ui\ \-\-register\ checking\ \-\-cleared
.fi .fi
.RE .RE
.PP .PP
Normally the register screen shows transactions in the current account
and any of its subaccounts (inclusive mode).
If it was entered from accounts screen in flat mode, it shows
transactions affecting this account specifically, without considering
subaccounts (exclusive mode).
As on the accounts screen you can toggle this with the \f[C]F\f[] key.
.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.
\f[C]U\f[] toggles uncleared mode, in which only uncleared \f[C]U\f[] toggles uncleared mode, in which only uncleared

View File

@ -208,14 +208,16 @@ accounts and their latest ending balances. if you specify a query on the
command line, it shows just the matched accounts and the balances from command line, it shows just the matched accounts and the balances from
matched transactions. matched transactions.
When not in flat mode, indentation indicates the account hierarchy. Account names are normally indented to show the hierarchy (tree
`F' toggles flat mode on and off. mode). To see less detail, set a depth limit by pressing a number key,
`1' to `9'. `0' shows even less detail, collapsing all accounts to a
single total. `-' and `+' (or `=') decrease and increase the depth
limit. To remove the depth limit, set it higher than the maximum
account depth, or press `ESCAPE'.
By default, all subaccounts are displayed. To see less detail, set a `F' toggles flat mode on and off. In flat mode, accounts are listed
depth limit by pressing a number key, `1' to `9'. `0' shows even less without indentation (and account registers will exclude subaccounts, see
detail, collapsing all accounts to a single total. `-' and `+' (or below).
`=') 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 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
@ -235,24 +237,20 @@ File: hledger-ui.1.info, Node: Register screen, Next: Transaction screen, Pre
3.2 Register screen 3.2 Register screen
=================== ===================
This screen lists all transactions affecting a particular account, like This screen shows the transactions affecting a particular account, like
a check register. Unlike hledger's register command (which lists a check register. Each line represents one transaction and shows:
individual postings), in hledger-ui's register:
* Each line represents a whole transaction. * the other account(s) involved, in abbreviated form. (If there are
both real and virtual postings, it shows only the accounts
affected by real postings.)
* For each transaction, it shows the other account(s) involved, in * the overall change to the current account's balance; positive for
abbreviated form. (If there are both real and virtual postings, it an inflow to this account, negative for an outflow.
shows only the accounts affected by real postings.)
* It shows the overall change to the current account's balance from * the current account's historic balance (if no query other than a
each transaction; positive for an inflow to this account, negative date limit is in effect) or the running total starting from zero
for an outflow. (otherwise), after the transaction.
Eg, these will show historic balances:
* When no query other than a date limit is in effect, it shows the
current account's historic balance as of the transaction date.
Otherwise it shows a running total starting from zero. Eg, these
will show historic balances:
$ hledger-ui $ hledger-ui
@ -268,6 +266,12 @@ individual postings), in hledger-ui's register:
$ hledger-ui --register checking --cleared $ hledger-ui --register checking --cleared
Normally the register screen shows transactions in the current
account and any of its subaccounts (inclusive mode). If it was entered
from accounts screen in flat mode, it shows transactions affecting this
account specifically, without considering subaccounts (exclusive mode).
As on the accounts screen you can toggle this with the `F' key.
`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
uncleared transactions/postings are shown. uncleared transactions/postings are shown.
@ -328,11 +332,11 @@ Node: SCREENS5098
Ref: #screens5185 Ref: #screens5185
Node: Accounts screen5275 Node: Accounts screen5275
Ref: #accounts-screen5405 Ref: #accounts-screen5405
Node: Register screen6635 Node: Register screen6710
Ref: #register-screen6792 Ref: #register-screen6867
Node: Transaction screen8446 Node: Transaction screen8688
Ref: #transaction-screen8606 Ref: #transaction-screen8848
Node: Error screen9473 Node: Error screen9715
Ref: #error-screen9597 Ref: #error-screen9839
 
End Tag Table End Tag Table

View File

@ -114,14 +114,15 @@ It lists accounts and their balances, like hledger's balance command.
By default, it shows all accounts and their latest ending balances. By default, it shows all accounts and their latest ending balances.
if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions.
When not in flat mode, indentation indicates the account hierarchy. `F` toggles flat mode on and off. Account names are normally indented to show the hierarchy (tree mode).
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`.
`0` shows even less detail, collapsing all accounts to a single total. `0` shows even less detail, collapsing all accounts to a single total.
`-` and `+` (or `=`) decrease and increase 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`. To remove the depth limit, set it higher than the maximum account depth, or press `ESCAPE`.
`F` toggles flat mode on and off. In flat mode, accounts are listed without indentation
(and account registers will exclude subaccounts, see below).
`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
not shown. `U` toggles uncleared mode, in which only uncleared not shown. `U` toggles uncleared mode, in which only uncleared
@ -137,24 +138,19 @@ Press `right` or `enter` to view an account's transactions register.
## Register screen ## Register screen
This screen lists all transactions affecting a particular account, like This screen shows the transactions affecting a particular account, like a check register.
a check register. Unlike hledger's register command (which Each line represents one transaction and shows:
lists individual postings), in hledger-ui's register:
- Each line represents a whole transaction. - the other account(s) involved, in abbreviated form.
(If there are both real and virtual postings, it
- For each transaction, it shows the other account(s) involved, in
abbreviated form. (If there are both real and virtual postings, it
shows only the accounts affected by real postings.) shows only the accounts affected by real postings.)
- It shows the overall change to the current account's balance from - the overall change to the current account's balance;
each transaction; positive for an inflow to this account, negative positive for an inflow to this account, negative for an outflow.
for an outflow.
- When no query other than a date limit is in effect, it shows the - the current account's historic balance (if no query other than a date limit is in effect)
current account's historic balance as of the transaction date. or the running total starting from zero (otherwise), after the transaction.
Otherwise it shows a running total starting from zero. Eg, these Eg, these will show historic balances:
will show historic balances:
``` ```
$ hledger-ui $ hledger-ui
@ -170,6 +166,12 @@ lists individual postings), in hledger-ui's register:
$ hledger-ui --register checking --cleared $ hledger-ui --register checking --cleared
``` ```
Normally the register screen shows transactions in the current account and any of its subaccounts
(inclusive mode). If it was entered from accounts screen in flat mode,
it shows transactions affecting this account specifically, without
considering subaccounts (exclusive mode).
As on the accounts screen you can toggle this with the `F` key.
`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
not shown. `U` toggles uncleared mode, in which only uncleared not shown. `U` toggles uncleared mode, in which only uncleared

View File

@ -179,14 +179,16 @@ SCREENS
on the command line, it shows just the matched accounts and the bal- on the command line, it shows just the matched accounts and the bal-
ances from matched transactions. ances from matched transactions.
When not in flat mode, indentation indicates the account hierarchy. F Account names are normally indented to show the hierarchy (tree mode).
toggles flat mode on and off. To see less detail, set a depth limit by pressing a number key, 1 to 9.
0 shows even less detail, collapsing all accounts to a single total. -
and + (or =) decrease and increase the depth limit. To remove the
depth limit, set it higher than the maximum account depth, or press
ESCAPE.
By default, all subaccounts are displayed. To see less detail, set a F toggles flat mode on and off. In flat mode, accounts are listed
depth limit by pressing a number key, 1 to 9. 0 shows even less without indentation (and account registers will exclude subaccounts,
detail, collapsing all accounts to a single total. - and + (or =) see below).
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 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
@ -201,24 +203,20 @@ SCREENS
Press right or enter to view an account's transactions register. Press right or enter to view an account's transactions register.
Register screen Register screen
This screen lists all transactions affecting a particular account, like This screen shows the transactions affecting a particular account, like
a check register. Unlike hledger's register command (which lists indi- a check register. Each line represents one transaction and shows:
vidual postings), in hledger-ui's register:
o Each line represents a whole transaction. o the other account(s) involved, in abbreviated form. (If there are
both real and virtual postings, it shows only the accounts affected
by real postings.)
o For each transaction, it shows the other account(s) involved, in o the overall change to the current account's balance; positive for an
abbreviated form. (If there are both real and virtual postings, it inflow to this account, negative for an outflow.
shows only the accounts affected by real postings.)
o It shows the overall change to the current account's balance from o the current account's historic balance (if no query other than a date
each transaction; positive for an inflow to this account, negative limit is in effect) or the running total starting from zero (other-
for an outflow. wise), after the transaction.
Eg, these will show historic balances:
o When no query other than a date limit is in effect, it shows the cur-
rent account's historic balance as of the transaction date. Other-
wise it shows a running total starting from zero. Eg, these will
show historic balances:
$ hledger-ui $ hledger-ui
$ hledger-ui --begin 'this month' $ hledger-ui --begin 'this month'
@ -231,6 +229,12 @@ SCREENS
$ hledger-ui --begin 'this month' desc:market $ hledger-ui --begin 'this month' desc:market
$ hledger-ui --register checking --cleared $ hledger-ui --register checking --cleared
Normally the register screen shows transactions in the current account
and any of its subaccounts (inclusive mode). If it was entered from
accounts screen in flat mode, it shows transactions affecting this
account specifically, without considering subaccounts (exclusive mode).
As on the accounts screen you can toggle this with the F key.
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
transactions/postings are shown. transactions/postings are shown.