hledger-ui 1.22 → 1.22.1
raw patch · 6 files changed
+284/−120 lines, 6 filesdep ~hledgerdep ~hledger-lib
Dependency ranges changed: hledger, hledger-lib
Files
- CHANGES.md +15/−0
- Hledger/UI/TransactionScreen.hs +16/−23
- hledger-ui.1 +54/−8
- hledger-ui.cabal +5/−5
- hledger-ui.info +101/−30
- hledger-ui.txt +93/−54
CHANGES.md view
@@ -9,6 +9,21 @@ User-visible changes in hledger-ui. See also the hledger changelog. +# 1.22.1 2021-08-02++Improvements++- Allow megaparsec 9.1.++Fixes++- Up/down keys work on the transaction screen again (broken since 1.22). + (#1607, Stephen Morgan)++- Fix a possible off-by-one bug with valuation date when using `V` key on+ the transaction screen. (If it ever needs to use the journal's last day+ as valuation date, use that day, not the day after.)+ # 1.22 2021-07-03 Improvements
Hledger/UI/TransactionScreen.hs view
@@ -5,10 +5,8 @@ {-# LANGUAGE TupleSections #-} module Hledger.UI.TransactionScreen- (transactionScreen- ,rsSelect- )-where+( transactionScreen+) where import Control.Monad import Control.Monad.IO.Class (liftIO)@@ -133,9 +131,7 @@ tsDraw _ = error "draw function called with wrong screen type, should not happen" -- PARTIAL: tsHandle :: UIState -> BrickEvent Name AppEvent -> EventM Name (Next UIState)-tsHandle ui@UIState{aScreen=s@TransactionScreen{tsTransaction=(i,t)- ,tsTransactions=nts- }+tsHandle ui@UIState{aScreen=TransactionScreen{tsTransaction=(i,t), tsTransactions=nts} ,aopts=UIOpts{cliopts_=copts} ,ajournal=j ,aMode=mode@@ -181,28 +177,25 @@ -- EvKey (KChar 'E') [] -> continue $ regenerateScreens j d $ stToggleEmpty ui -- EvKey (KChar 'C') [] -> continue $ regenerateScreens j d $ stToggleCleared ui -- EvKey (KChar 'R') [] -> continue $ regenerateScreens j d $ stToggleReal ui- VtyEvent (EvKey (KChar 'B') []) ->- continue $- regenerateScreens j d $- toggleCost ui- VtyEvent (EvKey (KChar 'V') []) ->- continue $- regenerateScreens j d $- toggleValue ui+ VtyEvent (EvKey (KChar 'B') []) -> continue . regenerateScreens j d $ toggleCost ui+ VtyEvent (EvKey (KChar 'V') []) -> continue . regenerateScreens j d $ toggleValue ui - VtyEvent e | e `elem` moveUpEvents -> continue $ regenerateScreens j d ui{aScreen=s{tsTransaction=(iprev,tprev)}}- VtyEvent e | e `elem` moveDownEvents -> continue $ regenerateScreens j d ui{aScreen=s{tsTransaction=(inext,tnext)}}- VtyEvent e | e `elem` moveLeftEvents -> continue ui''- where- ui'@UIState{aScreen=scr} = popScreen ui- ui'' = ui'{aScreen=rsSelect (fromIntegral i) scr}+ VtyEvent e | e `elem` moveUpEvents -> continue $ tsSelect iprev tprev ui+ VtyEvent e | e `elem` moveDownEvents -> continue $ tsSelect inext tnext ui+ VtyEvent e | e `elem` moveLeftEvents -> continue . popScreen $ tsSelect i t ui -- Probably not necessary to tsSelect here, but it's safe. VtyEvent (EvKey (KChar 'l') [MCtrl]) -> redraw ui VtyEvent (EvKey (KChar 'z') [MCtrl]) -> suspend ui _ -> continue ui tsHandle _ _ = error "event handler called with wrong screen type, should not happen" -- PARTIAL: +-- | Select a new transaction and update the previous register screen+tsSelect i t ui@UIState{aScreen=s@TransactionScreen{}} = case aPrevScreens ui of+ x:xs -> ui'{aPrevScreens=rsSelect i x : xs}+ [] -> ui'+ where ui' = ui{aScreen=s{tsTransaction=(i,t)}}+tsSelect _ _ ui = ui+ -- | Select the nth item on the register screen.-rsSelect i scr@RegisterScreen{..} = scr{rsList=l'}- where l' = listMoveTo (i-1) rsList+rsSelect i scr@RegisterScreen{..} = scr{rsList=listMoveTo (fromInteger $ i-1) rsList} rsSelect _ scr = scr
hledger-ui.1 view
@@ -1,5 +1,5 @@ -.TH "HLEDGER-UI" "1" "July 2021" "hledger-ui-1.22 " "hledger User Manuals"+.TH "HLEDGER-UI" "1" "August 2021" "hledger-ui-1.22.1 " "hledger User Manuals" @@ -7,7 +7,7 @@ .PP hledger-ui is a terminal interface (TUI) for the hledger accounting tool.-This manual is for hledger-ui 1.22.+This manual is for hledger-ui 1.22.1. .SH SYNOPSIS .PP \f[C]hledger-ui [OPTIONS] [QUERYARGS]\f[R]@@ -302,12 +302,6 @@ active; for now pressing \f[C]b\f[R] \f[C]b\f[R] \f[C]v\f[R] should reliably reset to normal mode. .PP-With \f[C]--watch\f[R] active, if you save an edit to the journal file-while viewing the transaction screen in cost or value mode, the-\f[C]B\f[R]/\f[C]V\f[R] keys will stop working.-To work around, press \f[C]g\f[R] to force a manual reload, or exit the-transaction screen.-.PP \f[C]q\f[R] quits the application. .PP Additional screen-specific keys are described below.@@ -439,6 +433,58 @@ 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.)+.SH TIPS+.SS Watch mode+.PP+One of hledger-ui\[aq]s best features is the auto-reloading+\f[C]--watch\f[R] mode.+With this flag, it will update the display automatically whenever+changes are saved to the data files.+.PP+This is very useful when reconciling.+A good workflow is to have your bank\[aq]s online register open in a+browser window, for reference; the journal file open in an editor+window; and hledger-ui in watch mode in a terminal window, eg:+.IP+.nf+\f[C]+$ hledger-ui --watch --register checking -C+\f[R]+.fi+.PP+As you mark things cleared in the editor, you can see the effect+immediately without having to context switch.+This leaves more mental bandwidth for your accounting.+Of course you can still interact with hledger-ui when needed, eg to+toggle cleared mode, or to explore the history.+.SS Watch mode limitations+.PP+There are situations in which it won\[aq]t work, ie the display will not+update when you save a change (because the underlying \f[C]inotify\f[R]+library does not support it).+Here are some that we know of:+.IP \[bu] 2+Certain editors: saving with \f[C]gedit\f[R], and perhaps any Gnome+application, won\[aq]t be detected (#1617).+Jetbrains IDEs, such as IDEA, also may not work (#911).+.IP \[bu] 2+Certain unusual filesystems might not be supported.+(All the usual ones on unix, mac and windows are supported.)+.PP+In such cases, the workaround is to switch to the hledger-ui window and+press \f[C]g\f[R] each time you want it to reload.+(Actually, see #1617 for another workaround, and let us know if it works+for you.)+.PP+If you leave \f[C]hledger-ui --watch\f[R] running for days, on certain+platforms (?), perhaps with many transactions in your journal (?),+perhaps with large numbers of other files present (?), you may see it+gradually using more and more memory and CPU over time, as seen in+\f[C]top\f[R] or Activity Monitor or Task Manager.+.PP+A workaround is to \f[C]q\f[R]uit and restart it, or to suspend it+(\f[C]CTRL-z\f[R]) and restart it (\f[C]fg\f[R]) if your shell supports+that. .SH ENVIRONMENT .PP \f[B]COLUMNS\f[R] The screen width to use.
hledger-ui.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: hledger-ui-version: 1.22+version: 1.22.1 synopsis: Curses-style terminal interface for the hledger accounting system description: A simple curses-style terminal user interface for the hledger accounting system. It can be a more convenient way to browse your accounts than the CLI.@@ -63,7 +63,7 @@ hs-source-dirs: ./ ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans- cpp-options: -DVERSION="1.22"+ cpp-options: -DVERSION="1.22.1" build-depends: ansi-terminal >=0.9 , async@@ -77,9 +77,9 @@ , extra >=1.6.3 , filepath , fsnotify >=0.2.1.2 && <0.4- , hledger ==1.22.*- , hledger-lib ==1.22.*- , megaparsec >=7.0.0 && <9.1+ , hledger >=1.22.1 && <1.23+ , hledger-lib >=1.22.1 && <1.23+ , megaparsec >=7.0.0 && <9.2 , microlens >=0.4 , microlens-platform >=0.2.3.1 , process >=1.2
hledger-ui.info view
@@ -1,8 +1,8 @@-This is hledger-ui.info, produced by makeinfo version 6.7 from stdin.+This is hledger-ui.info, produced by makeinfo version 6.8 from stdin. INFO-DIR-SECTION User Applications START-INFO-DIR-ENTRY-* hledger-ui: (hledger-ui/hledger-ui). Terminal UI for the hledger accounting tool.+* hledger-ui: (hledger-ui). Terminal UI for the hledger accounting tool. END-INFO-DIR-ENTRY @@ -12,7 +12,7 @@ ************* hledger-ui is a terminal interface (TUI) for the hledger accounting-tool. This manual is for hledger-ui 1.22.+tool. This manual is for hledger-ui 1.22.1. 'hledger-ui [OPTIONS] [QUERYARGS]' 'hledger ui -- [OPTIONS] [QUERYARGS]'@@ -44,6 +44,7 @@ * OPTIONS:: * KEYS:: * SCREENS::+* TIPS:: * ENVIRONMENT:: * FILES:: * BUGS::@@ -311,17 +312,12 @@ active; for now pressing 'b' 'b' 'v' should reliably reset to normal mode. - With '--watch' active, if you save an edit to the journal file while-viewing the transaction screen in cost or value mode, the 'B'/'V' keys-will stop working. To work around, press 'g' to force a manual reload,-or exit the transaction screen.- 'q' quits the application. Additional screen-specific keys are described below. -File: hledger-ui.info, Node: SCREENS, Next: ENVIRONMENT, Prev: KEYS, Up: Top+File: hledger-ui.info, Node: SCREENS, Next: TIPS, Prev: KEYS, Up: Top 3 SCREENS *********@@ -465,9 +461,73 @@ to cancel the reload attempt.) -File: hledger-ui.info, Node: ENVIRONMENT, Next: FILES, Prev: SCREENS, Up: Top+File: hledger-ui.info, Node: TIPS, Next: ENVIRONMENT, Prev: SCREENS, Up: Top -4 ENVIRONMENT+4 TIPS+******++* Menu:++* Watch mode::+* Watch mode limitations::+++File: hledger-ui.info, Node: Watch mode, Next: Watch mode limitations, Up: TIPS++4.1 Watch mode+==============++One of hledger-ui's best features is the auto-reloading '--watch' mode.+With this flag, it will update the display automatically whenever+changes are saved to the data files.++ This is very useful when reconciling. A good workflow is to have+your bank's online register open in a browser window, for reference; the+journal file open in an editor window; and hledger-ui in watch mode in a+terminal window, eg:++$ hledger-ui --watch --register checking -C++ As you mark things cleared in the editor, you can see the effect+immediately without having to context switch. This leaves more mental+bandwidth for your accounting. Of course you can still interact with+hledger-ui when needed, eg to toggle cleared mode, or to explore the+history.+++File: hledger-ui.info, Node: Watch mode limitations, Prev: Watch mode, Up: TIPS++4.2 Watch mode limitations+==========================++There are situations in which it won't work, ie the display will not+update when you save a change (because the underlying 'inotify' library+does not support it). Here are some that we know of:++ * Certain editors: saving with 'gedit', and perhaps any Gnome+ application, won't be detected (#1617). Jetbrains IDEs, such as+ IDEA, also may not work (#911).++ * Certain unusual filesystems might not be supported. (All the usual+ ones on unix, mac and windows are supported.)++ In such cases, the workaround is to switch to the hledger-ui window+and press 'g' each time you want it to reload. (Actually, see #1617 for+another workaround, and let us know if it works for you.)++ If you leave 'hledger-ui --watch' running for days, on certain+platforms (?), perhaps with many transactions in your journal (?),+perhaps with large numbers of other files present (?), you may see it+gradually using more and more memory and CPU over time, as seen in 'top'+or Activity Monitor or Task Manager.++ A workaround is to 'q'uit and restart it, or to suspend it ('CTRL-z')+and restart it ('fg') if your shell supports that.+++File: hledger-ui.info, Node: ENVIRONMENT, Next: FILES, Prev: TIPS, Up: Top++5 ENVIRONMENT ************* *COLUMNS* The screen width to use. Default: the full terminal width.@@ -495,7 +555,7 @@ File: hledger-ui.info, Node: FILES, Next: BUGS, Prev: ENVIRONMENT, Up: Top -5 FILES+6 FILES ******* Reads data from one or more files in hledger journal, timeclock,@@ -506,7 +566,7 @@ File: hledger-ui.info, Node: BUGS, Prev: FILES, Up: Top -6 BUGS+7 BUGS ****** The need to precede options with '--' when invoked from hledger is@@ -533,26 +593,37 @@ Tag Table:-Node: Top232+Node: Top221 Node: OPTIONS1646 Ref: #options1743 Node: KEYS6144 Ref: #keys6239-Node: SCREENS10558-Ref: #screens10663-Node: Accounts screen10753-Ref: #accounts-screen10881-Node: Register screen13096-Ref: #register-screen13251-Node: Transaction screen15248-Ref: #transaction-screen15406-Node: Error screen16276-Ref: #error-screen16398-Node: ENVIRONMENT16642-Ref: #environment16756-Node: FILES17563-Ref: #files17662-Node: BUGS17875-Ref: #bugs17952+Node: SCREENS10310+Ref: #screens10408+Node: Accounts screen10498+Ref: #accounts-screen10626+Node: Register screen12841+Ref: #register-screen12996+Node: Transaction screen14993+Ref: #transaction-screen15151+Node: Error screen16021+Ref: #error-screen16143+Node: TIPS16387+Ref: #tips16486+Node: Watch mode16538+Ref: #watch-mode16655+Node: Watch mode limitations17401+Ref: #watch-mode-limitations17542+Node: ENVIRONMENT18678+Ref: #environment18789+Node: FILES19596+Ref: #files19695+Node: BUGS19908+Ref: #bugs19985 End Tag Table+++Local Variables:+coding: utf-8+End:
hledger-ui.txt view
@@ -5,7 +5,7 @@ NAME hledger-ui is a terminal interface (TUI) for the hledger accounting- tool. This manual is for hledger-ui 1.22.+ tool. This manual is for hledger-ui 1.22.1. SYNOPSIS hledger-ui [OPTIONS] [QUERYARGS]@@ -276,55 +276,50 @@ There's not yet any visual reminder when cost or value mode is active; for now pressing b b v should reliably reset to normal mode. - With --watch active, if you save an edit to the journal file while- viewing the transaction screen in cost or value mode, the B/V keys will- stop working. To work around, press g to force a manual reload, or- exit the transaction screen.- q quits the application. Additional screen-specific keys are described below. SCREENS Accounts screen- This is normally the first screen displayed. It lists accounts and- their balances, like hledger's balance command. By default, it shows- all accounts and their latest ending balances (including the balances- of subaccounts). If you specify a query on the command line, it shows+ This is normally the first screen displayed. It lists accounts and+ their balances, like hledger's balance command. By default, it shows+ all accounts and their latest ending balances (including the balances+ of subaccounts). If you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. - Account names are shown as a flat list by default; press t to toggle- tree mode. In list mode, account balances are exclusive of subac-- counts, except where subaccounts are hidden by a depth limit (see- below). In tree mode, all account balances are inclusive of subac-+ Account names are shown as a flat list by default; press t to toggle+ tree mode. In list mode, account balances are exclusive of subac-+ counts, except where subaccounts are hidden by a depth limit (see+ below). In tree mode, all account balances are inclusive of subac- counts. - To see less detail, press a number key, 1 to 9, to set a depth limit.+ To see less detail, press a number key, 1 to 9, to set a depth limit. Or use - to decrease and +/= to increase the depth limit. 0 shows even- less detail, collapsing all accounts to a single total. To remove the- depth limit, set it higher than the maximum account depth, or press+ less detail, collapsing all accounts to a single total. To remove the+ depth limit, set it higher than the maximum account depth, or press ESCAPE. H toggles between showing historical balances or period balances. His-- torical balances (the default) are ending balances at the end of the- report period, taking into account all transactions before that date- (filtered by the filter query if any), including transactions before- the start of the report period. In other words, historical balances- are what you would see on a bank statement for that account (unless- disturbed by a filter query). Period balances ignore transactions+ torical balances (the default) are ending balances at the end of the+ report period, taking into account all transactions before that date+ (filtered by the filter query if any), including transactions before+ the start of the report period. In other words, historical balances+ are what you would see on a bank statement for that account (unless+ disturbed by 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. U toggles filtering by unmarked status, including or excluding unmarked postings in the balances. 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+ 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 are ignored. - Z toggles nonzero mode, in which only accounts with nonzero balances- are shown (hledger-ui shows zero items by default, unlike command-line+ Z toggles nonzero mode, in which only accounts with nonzero balances+ are shown (hledger-ui shows zero items by default, unlike command-line hledger). Press right or enter to view an account's transactions register.@@ -333,66 +328,110 @@ This screen shows the transactions affecting a particular account, like a check register. Each line represents one transaction and shows: - o the other account(s) involved, in abbreviated form. (If there are- both real and virtual postings, it shows only the accounts affected+ 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 the overall change to the current account's balance; positive for an+ o the overall change to the current account's balance; positive for an inflow to this account, negative for an outflow. o the running historical total or period total for the current account,- after the transaction. This can be toggled with H. Similar to the- accounts screen, the historical total is affected by transactions- (filtered by the filter query) before the report start date, while+ after the transaction. This can be toggled with H. Similar to the+ accounts screen, the historical total is affected by transactions+ (filtered by the filter query) before the report start date, while the period total is not. If the historical total is not disturbed by- a filter query, it will be the running historical balance you would+ a filter query, it will be the running historical balance you would see on a bank register for the current account. - Transactions affecting this account's subaccounts will be included in+ Transactions affecting this account's subaccounts will be included in the register if the accounts screen is in tree mode, or if it's in list- mode but this account has subaccounts which are not shown due to a- depth limit. In other words, the register always shows the transac-- tions contributing to the balance shown on the accounts screen. Tree+ mode but this account has subaccounts which are not shown due to a+ depth limit. In other words, the register always shows the transac-+ tions contributing to the balance shown on the accounts screen. Tree mode/list mode can be toggled with t here also. - U toggles filtering by unmarked status, showing or hiding unmarked+ U toggles filtering by unmarked status, showing or hiding unmarked transactions. Similarly, P toggles pending transactions, and C toggles- cleared transactions. (By default, transactions with all statuses are- shown; if you activate one or two status filters, only those transac-+ cleared transactions. (By default, transactions with all statuses are+ shown; if you activate one or two status filters, only those transac- tions are shown; and if you activate all three, the filter is removed.) R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only transactions posting a nonzero- change are shown (hledger-ui shows zero items by default, unlike com-+ Z 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.) +TIPS+ Watch mode+ One of hledger-ui's best features is the auto-reloading --watch mode.+ With this flag, it will update the display automatically whenever+ changes are saved to the data files.++ This is very useful when reconciling. A good workflow is to have your+ bank's online register open in a browser window, for reference; the+ journal file open in an editor window; and hledger-ui in watch mode in+ a terminal window, eg:++ $ hledger-ui --watch --register checking -C++ As you mark things cleared in the editor, you can see the effect imme-+ diately without having to context switch. This leaves more mental+ bandwidth for your accounting. Of course you can still interact with+ hledger-ui when needed, eg to toggle cleared mode, or to explore the+ history.++ Watch mode limitations+ There are situations in which it won't work, ie the display will not+ update when you save a change (because the underlying inotify library+ does not support it). Here are some that we know of:++ o Certain editors: saving with gedit, and perhaps any Gnome applica-+ tion, won't be detected (#1617). Jetbrains IDEs, such as IDEA, also+ may not work (#911).++ o Certain unusual filesystems might not be supported. (All the usual+ ones on unix, mac and windows are supported.)++ In such cases, the workaround is to switch to the hledger-ui window and+ press g each time you want it to reload. (Actually, see #1617 for+ another workaround, and let us know if it works for you.)++ If you leave hledger-ui --watch running for days, on certain platforms+ (?), perhaps with many transactions in your journal (?), perhaps with+ large numbers of other files present (?), you may see it gradually+ using more and more memory and CPU over time, as seen in top or Activ-+ ity Monitor or Task Manager.++ A workaround is to quit and restart it, or to suspend it (CTRL-z) and+ restart it (fg) if your shell supports that.+ ENVIRONMENT COLUMNS The screen width to use. Default: the full terminal width. @@ -465,4 +504,4 @@ -hledger-ui-1.22 July 2021 HLEDGER-UI(1)+hledger-ui-1.22.1 August 2021 HLEDGER-UI(1)