diff --git a/hledger-lib/Ledger/Transaction.hs b/hledger-lib/Ledger/Transaction.hs index f366a3cfd..616e33d92 100644 --- a/hledger-lib/Ledger/Transaction.hs +++ b/hledger-lib/Ledger/Transaction.hs @@ -82,7 +82,7 @@ showTransaction' elide effective t = showpostingnoamt p = rstrip $ showacct p ++ " " ++ showcomment (pcomment p) showacct p = " " ++ showstatus p ++ printf (printf "%%-%ds" w) (showAccountName Nothing (ptype p) (paccount p)) w = maximum $ map (length . paccount) ps - showamount = printf "%12s" . showMixedAmount + showamount = printf "%12s" . showMixedAmountOrZero showcomment s = if null s then "" else " ; "++s showstatus p = if pstatus p then "* " else "" diff --git a/tests/zero-handling.test b/tests/zero-handling.test new file mode 100644 index 000000000..db9932655 --- /dev/null +++ b/tests/zero-handling.test @@ -0,0 +1,12 @@ +# a zero amount is always displayed as just "0", regardless of any commodity/decimal places/price (like ledger) +# +-f- print --empty +<<< +2010/3/1 x + a $0.00 @ 3EUR + b +>>> +2010/03/01 x + a 0 + b 0 +