diff --git a/hledger-ui/Hledger/UI/AccountsScreen.hs b/hledger-ui/Hledger/UI/AccountsScreen.hs index 84b0d0b13..0dc2d0da3 100644 --- a/hledger-ui/Hledger/UI/AccountsScreen.hs +++ b/hledger-ui/Hledger/UI/AccountsScreen.hs @@ -111,6 +111,7 @@ asDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} toplabel = files <+> nonzero <+> str " accounts" + <+> withAttr (borderAttr <> "query") (str (if flat_ ropts then " (flat)" else "")) <+> borderQueryStr querystr <+> togglefilters <+> borderDepthStr mdepth diff --git a/hledger-ui/Hledger/UI/RegisterScreen.hs b/hledger-ui/Hledger/UI/RegisterScreen.hs index c6f7b1a4b..11ad5a8e1 100644 --- a/hledger-ui/Hledger/UI/RegisterScreen.hs +++ b/hledger-ui/Hledger/UI/RegisterScreen.hs @@ -48,21 +48,20 @@ rsSetAccount a scr@RegisterScreen{} = scr{rsAccount=replaceHiddenAccountsNameWit rsSetAccount _ scr = scr 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'}} where -- gather arguments and queries - ropts = (reportopts_ $ cliopts_ opts) - { - depth_=Nothing, - balancetype_=HistoricalBalance - } + ropts' = ropts{ + depth_=Nothing + ,balancetype_=HistoricalBalance + } -- XXX temp - thisacctq = Acct $ accountNameToAccountRegex rsAccount -- includes subs - q = filterQuery (not . queryIsDepth) $ queryFromOpts d ropts + thisacctq = Acct $ (if flat_ ropts then accountNameToAccountOnlyRegex else accountNameToAccountRegex) rsAccount + q = filterQuery (not . queryIsDepth) $ queryFromOpts d ropts' - (_label,items) = accountTransactionsReport ropts j q thisacctq - items' = (if empty_ ropts then id else filter (not . isZeroMixedAmount . fifth6)) $ -- without --empty, exclude no-change txns + (_label,items) = accountTransactionsReport ropts' j q thisacctq + items' = (if empty_ ropts' then id else filter (not . isZeroMixedAmount . fifth6)) $ -- without --empty, exclude no-change txns reverse -- most recent last items @@ -107,16 +106,18 @@ rsDraw UIState{aopts=UIOpts{cliopts_=CliOpts{reportopts_=ropts}} -- Minibuffer e -> [minibuffer e, maincontent] _ -> [maincontent] where - toplabel = withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount) - <+> togglefilters - <+> str " transactions" - <+> borderQueryStr (query_ ropts) - -- <+> str " and subs" - <+> str " (" - <+> cur - <+> str "/" - <+> total - <+> str ")" + toplabel = + withAttr ("border" <> "bold") (str $ T.unpack $ replaceHiddenAccountsNameWith "All" rsAccount) + <+> withAttr (borderAttr <> "query") (str $ if flat_ ropts then " (exclusive)" else "") + <+> togglefilters + <+> str " transactions" + <+> borderQueryStr (query_ ropts) + -- <+> str " and subs" + <+> str " (" + <+> cur + <+> str "/" + <+> total + <+> str ")" togglefilters = case concat [ if cleared_ ropts then ["cleared"] else [] @@ -247,6 +248,7 @@ rsHandle ui@UIState{ EvKey (KChar c) [] | c `elem` ['h','?'] -> continue $ setMode Help ui 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 'F') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleFlat ui) EvKey (KChar 'E') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleEmpty ui) EvKey (KChar 'C') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleCleared ui) EvKey (KChar 'U') [] -> scrollTop >> (continue $ regenerateScreens j d $ toggleUncleared ui) diff --git a/hledger-ui/Hledger/UI/UIState.hs b/hledger-ui/Hledger/UI/UIState.hs index 60d7d7995..03daeb0d9 100644 --- a/hledger-ui/Hledger/UI/UIState.hs +++ b/hledger-ui/Hledger/UI/UIState.hs @@ -65,11 +65,12 @@ setFilter :: String -> UIState -> UIState setFilter s ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} = ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{query_=s}}}} --- | Clear all filter queries/flags. +-- | Clear all filters/flags. resetFilter :: UIState -> UIState resetFilter ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} = ui{aopts=uopts{cliopts_=copts{reportopts_=ropts{ - empty_=True + accountlistmode_=ALTree + ,empty_=True ,cleared_=False ,pending_=False ,uncleared_=False diff --git a/hledger-ui/Hledger/UI/UIUtils.hs b/hledger-ui/Hledger/UI/UIUtils.hs index 6c750dc02..0ad2b1012 100644 --- a/hledger-ui/Hledger/UI/UIUtils.hs +++ b/hledger-ui/Hledger/UI/UIUtils.hs @@ -41,23 +41,21 @@ helpDialog = ,str " move selection" ,renderKey ("RIGHT/ENTER", "drill down") ,renderKey ("LEFT", "previous screen") - ,renderKey ("ESC", "cancel / reset to top") + ,renderKey ("ESC", "cancel / reset") ] ) ,(padLeftRight 1 $ vBox [ str "FILTERING" + ,renderKey ("/", "set a filter query") + ,renderKey ("DEL/BS", "remove filters") ,renderKey ("C", "toggle cleared filter") ,renderKey ("U", "toggle uncleared filter") ,renderKey ("R", "toggle real filter") ,renderKey ("E", "toggle nonzero filter") - ,renderKey ("/", "set a filter query") - ,renderKey ("DEL/BS", "remove filters") - ,str " " + ,renderKey ("F", "toggle flat/exclusive mode") ,str "accounts screen:" - ,renderKey ("F", "toggle flat mode") - ,renderKey ("-+0123456789", "") - ,str " adjust/set depth limit" + ,renderKey ("-+0123456789", "set depth limit") ] ) ] diff --git a/hledger-ui/doc/hledger-ui.1 b/hledger-ui/doc/hledger-ui.1 index 8b8d9aefd..17bea1a4d 100644 --- a/hledger-ui/doc/hledger-ui.1 +++ b/hledger-ui/doc/hledger-ui.1 @@ -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 accounts and the balances from matched transactions. .PP -When not in flat mode, indentation indicates the account hierarchy. -\f[C]F\f[] toggles flat mode on and off. -.PP -By default, all subaccounts are displayed. +Account names are normally indented to show the hierarchy (tree mode). To see less detail, set a depth limit by pressing a number key, \f[C]1\f[] to \f[C]9\f[]. \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, or press \f[C]ESCAPE\f[]. .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 postings are not shown. \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. .SS Register screen .PP -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\[aq]s register command (which lists individual postings), -in hledger\-ui\[aq]s register: +Each line represents one transaction and shows: .IP \[bu] 2 -Each line represents a whole transaction. -.IP \[bu] 2 -For each transaction, it shows the other account(s) involved, in -abbreviated form. +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.) .IP \[bu] 2 -It shows the overall change to the current account\[aq]s balance from -each transaction; positive for an inflow to this account, negative for -an outflow. +the overall change to the current account\[aq]s balance; positive for an +inflow to this account, negative for an outflow. .IP \[bu] 2 -When no query other than a date limit is in effect, it shows the current -account\[aq]s historic balance as of the transaction date. -Otherwise it shows a running total starting from zero. +the current account\[aq]s historic balance (if no query other than a +date limit is in effect) or the running total starting from zero +(otherwise), after the transaction. +.PD 0 +.P +.PD Eg, these will show historic balances: .RS 2 .IP @@ -331,6 +330,13 @@ $\ hledger\-ui\ \-\-register\ checking\ \-\-cleared .fi .RE .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 postings are not shown. \f[C]U\f[] toggles uncleared mode, in which only uncleared diff --git a/hledger-ui/doc/hledger-ui.1.info b/hledger-ui/doc/hledger-ui.1.info index 44724bd5a..888a8c1de 100644 --- a/hledger-ui/doc/hledger-ui.1.info +++ b/hledger-ui/doc/hledger-ui.1.info @@ -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 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). 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 -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'. + `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 uncleared transactions and 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 =================== -This screen lists all transactions affecting a particular account, like -a check register. Unlike hledger's register command (which lists -individual postings), in hledger-ui's register: +This screen shows the transactions affecting a particular account, like +a check register. Each line represents one transaction and shows: - * 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 - abbreviated form. (If there are both real and virtual postings, it - shows only the accounts affected by real postings.) + * the overall change to the current account's balance; positive for + an inflow to this account, negative for an outflow. - * It shows the overall change to the current account's balance from - each transaction; positive for an inflow to this account, negative - for an outflow. - - * 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: + * the current account's historic balance (if no query other than a + date limit is in effect) or the running total starting from zero + (otherwise), after the transaction. + Eg, these will show historic balances: $ hledger-ui @@ -268,6 +266,12 @@ individual postings), in hledger-ui's register: $ 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 are not shown. `U' toggles uncleared mode, in which only uncleared transactions/postings are shown. @@ -328,11 +332,11 @@ Node: SCREENS5098 Ref: #screens5185 Node: Accounts screen5275 Ref: #accounts-screen5405 -Node: Register screen6635 -Ref: #register-screen6792 -Node: Transaction screen8446 -Ref: #transaction-screen8606 -Node: Error screen9473 -Ref: #error-screen9597 +Node: Register screen6710 +Ref: #register-screen6867 +Node: Transaction screen8688 +Ref: #transaction-screen8848 +Node: Error screen9715 +Ref: #error-screen9839  End Tag Table diff --git a/hledger-ui/doc/hledger-ui.1.m4.md b/hledger-ui/doc/hledger-ui.1.m4.md index 1b73675a2..dd2e40b37 100644 --- a/hledger-ui/doc/hledger-ui.1.m4.md +++ b/hledger-ui/doc/hledger-ui.1.m4.md @@ -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. 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. - -By default, all subaccounts are displayed. +Account names are normally indented to show the hierarchy (tree 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`. +`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 [uncleared transactions and postings](/journal.html#transactions) are 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 -This screen lists all transactions affecting a particular account, like -a check register. Unlike hledger's register command (which -lists individual postings), in hledger-ui's register: +This screen shows the transactions affecting a particular account, like a check register. +Each line represents one transaction and shows: -- Each line represents a whole transaction. - -- For each transaction, it shows the other account(s) involved, in - abbreviated form. (If there are both real and virtual postings, it +- 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.) -- It shows the overall change to the current account's balance from - each transaction; positive for an inflow to this account, negative - for an outflow. +- the overall change to the current account's balance; + positive for an inflow to this account, negative for an outflow. -- 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: +- the current account's historic balance (if no query other than a date limit is in effect) + or the running total starting from zero (otherwise), after the transaction. + Eg, these will show historic balances: ``` $ hledger-ui @@ -170,6 +166,12 @@ lists individual postings), in hledger-ui's register: $ 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](/journal.html#transactions) are not shown. `U` toggles uncleared mode, in which only uncleared diff --git a/hledger-ui/doc/hledger-ui.1.txt b/hledger-ui/doc/hledger-ui.1.txt index 2d247149f..59bb31f74 100644 --- a/hledger-ui/doc/hledger-ui.1.txt +++ b/hledger-ui/doc/hledger-ui.1.txt @@ -179,14 +179,16 @@ SCREENS on the command line, it shows just the matched accounts and the bal- ances 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). + 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 - 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. + 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 uncleared transactions and postings 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. Register screen - This screen lists all transactions affecting a particular account, like - a check register. Unlike hledger's register command (which lists indi- - vidual postings), in hledger-ui's register: + This screen shows the transactions affecting a particular account, like + a check register. Each line represents one transaction and shows: - 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 - abbreviated form. (If there are both real and virtual postings, it - shows only the accounts affected by real postings.) + o the overall change to the current account's balance; positive for an + inflow to this account, negative for an outflow. - o It shows the overall change to the current account's balance from - each transaction; positive for an inflow to this account, negative - for an outflow. - - 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: + o the current account's historic balance (if no query other than a date + limit is in effect) or the running total starting from zero (other- + wise), after the transaction. + Eg, these will show historic balances: $ hledger-ui $ hledger-ui --begin 'this month' @@ -231,39 +229,45 @@ SCREENS $ hledger-ui --begin 'this month' desc:market $ hledger-ui --register checking --cleared - C toggles cleared mode, in which uncleared transactions and postings - are not shown. U toggles uncleared mode, in which only uncleared + 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 + are not shown. U toggles uncleared mode, in which only uncleared transactions/postings are shown. R toggles real mode, in which virtual postings are ignored. - E toggles nonzero mode, in which only transactions posting a nonzero - change are shown (hledger-ui shows zero items by default, unlike com- + E toggles nonzero mode, in which only transactions posting a nonzero + change are shown (hledger-ui shows zero items by default, unlike com- mand-line hledger). Press right (or enter) to view the selected transaction in detail. Transaction screen - This screen shows a single transaction, as a general journal entry, - similar to hledger's print command and journal format (hledger_jour- + This screen shows a single transaction, as a general journal entry, + similar to hledger's print command and journal format (hledger_jour- nal(5)). - The transaction's date(s) and any cleared flag, transaction code, - description, comments, along with all of its account postings are - shown. Simple transactions have two postings, but there can be more + The transaction's date(s) and any cleared flag, transaction code, + description, comments, along with all of its account postings are + shown. Simple transactions have two postings, but there can be more (or in certain cases, fewer). - up and down will step through all transactions listed in the previous - account register screen. In the title bar, the numbers in parentheses - show your position within that account register. They will vary + up and down will step through all transactions listed in the previous + account register screen. In the title bar, the numbers in parentheses + show your position within that account register. They will vary depending on which account register you came from (remember most trans- actions appear in multiple account registers). The #N number preceding them is the transaction's position within the complete unfiltered jour- nal, which is a more stable id (at least until the next reload). Error screen - This screen will appear if there is a problem, such as a parse error, - when you press g to reload. Once you have fixed the problem, press g + This screen will appear if there is a problem, such as a parse error, + when you press g to reload. Once you have fixed the problem, press g again to reload and resume normal operation. (Or, you can press escape to cancel the reload attempt.) @@ -271,17 +275,17 @@ ENVIRONMENT COLUMNS The screen width to use. Default: the full terminal width. LEDGER_FILE The journal file path when not specified with -f. Default: - ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- + ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). FILES - Reads data from one or more files in hledger journal, timeclock, time- - dot, or CSV format specified with -f, or $LEDGER_FILE, or - $HOME/.hledger.journal (on windows, perhaps + Reads data from one or more files in hledger journal, timeclock, time- + dot, or CSV format specified with -f, or $LEDGER_FILE, or + $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS - The need to precede options with -- when invoked from hledger is awk- + The need to precede options with -- when invoked from hledger is awk- ward. -f- doesn't work (hledger-ui can't read from stdin). @@ -292,14 +296,14 @@ BUGS which may cause a noticeable pause. Also there is no visual indication that this is in progress. - The register screen's switching between historic balance and running + The register screen's switching between historic balance and running total based on query arguments may be confusing, and there is no column heading to indicate which is being displayed. REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -313,7 +317,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1)