From 318a7ce234728b63dc776216068b31e1dc34b613 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 21 Aug 2019 07:11:55 +0100 Subject: [PATCH] reg: show negative amounts in red, like balance and Ledger --- hledger/Hledger/Cli/Commands/Register.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Register.hs b/hledger/Hledger/Cli/Commands/Register.hs index 5bb47838a..944b79748 100644 --- a/hledger/Hledger/Cli/Commands/Register.hs +++ b/hledger/Hledger/Cli/Commands/Register.hs @@ -175,8 +175,10 @@ postingsReportItemAsText opts preferredamtwidth preferredbalwidth (mdate, mendda BalancedVirtualPosting -> (\s -> "["++s++"]", acctwidth-2) VirtualPosting -> (\s -> "("++s++")", acctwidth-2) _ -> (id,acctwidth) - amt = showMixedAmountWithoutPrice $ pamount p - bal = showMixedAmountWithoutPrice b + showamt | color_ (reportopts_ opts) = cshowMixedAmountWithoutPrice + | otherwise = showMixedAmountWithoutPrice + amt = showamt $ pamount p + bal = showamt b -- alternate behaviour, show null amounts as 0 instead of blank -- amt = if null amt' then "0" else amt' -- bal = if null bal' then "0" else bal'