Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions hledger-lib/Hledger/Reports/MultiBalanceReport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,20 @@ markAccountBoring ReportSpec{_rsQuery=query,_rsReportOpts=ropts}

qdepth = fromMaybe maxBound . getAccountNameClippedDepth depthspec $ aname acct
balance = maybeStripPrices . case accountlistmode_ ropts of
ALTree | d == qdepth -> bdincludingsubs
_ -> bdexcludingsubs
ALTree ->
if d == qdepth
then bdincludingsubs
else bdexcludingsubs
ALFlat ->
if no_elide_ ropts
then bdincludingsubs
else bdexcludingsubs

-- Accounts which don't have enough interesting subaccounts
isBoringParent :: Account a -> Bool
isBoringParent acct = case accountlistmode_ ropts of
ALTree -> notEnoughSubs || droppedAccount
ALFlat -> True
ALFlat -> not $ no_elide_ ropts
where
notEnoughSubs = length interestingSubs < minimumSubs
droppedAccount = accountNameLevel (aname acct) <= drop_ ropts
Expand Down Expand Up @@ -431,7 +437,7 @@ buildReportRows makeRow ropts = mkRows True (-drop_ ropts) 0
allBoring a = aboring a && all allBoring (asubs a)
balance = case accountlistmode_ ropts of
ALTree -> bdincludingsubs
ALFlat -> bdexcludingsubs
ALFlat -> if no_elide_ ropts then bdincludingsubs else bdexcludingsubs

displayedName d boringParents name
| d == 0 && name == "root" = DisplayName "..." "..." 0
Expand Down
2 changes: 1 addition & 1 deletion hledger-ui/Hledger/UI/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ uiInitialState uopts0@UIOpts{uoCliOpts=copts@CliOpts{reportspec_=rspec@ReportSpe
_rsReportOpts=ropts{
depth_ = queryDepth $ _rsQuery rspec, -- query's depth part
period_ = periodfromoptsandargs, -- query's date part
no_elide_ = True, -- avoid squashing boring account names, for a more regular tree (unlike hledger)
no_elide_ = accountlistmode_ ropts == ALTree, -- avoid squashing boring account names, for a more regular tree (unlike hledger)
empty_ = not $ empty_ ropts, -- show zero items by default, hide them with -E (unlike hledger)
declared_ = True -- always show declared accounts even if unused
}
Expand Down
2 changes: 1 addition & 1 deletion hledger-ui/Hledger/UI/UIState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ setList = set accountlistmode ALFlat

-- | Toggle between flat and tree mode. If current mode is unspecified/default, assume it's flat.
toggleTree :: UIState -> UIState
toggleTree = over accountlistmode toggleTreeMode
toggleTree = over no_elide not . over accountlistmode toggleTreeMode
where
toggleTreeMode ALTree = ALFlat
toggleTreeMode ALFlat = ALTree
Expand Down
1 change: 1 addition & 0 deletions hledger/test/balance/219.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Ending balances (historical) in 2013-01:

|| 2013-01-31
=================++============
assets || 10
assets:checking || 10

# ** 2. multiple flags ending with --tree, equivalent to --tree
Expand Down
Loading