From 550357934f9e2f4aa391cc36f9a44ec640e8e9a8 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 6 Aug 2009 20:19:00 +0000 Subject: [PATCH] print: fix long account name truncation, align amounts --- Ledger/LedgerTransaction.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Ledger/LedgerTransaction.hs b/Ledger/LedgerTransaction.hs index e79c95304..b3ff9d99a 100644 --- a/Ledger/LedgerTransaction.hs +++ b/Ledger/LedgerTransaction.hs @@ -78,7 +78,8 @@ showLedgerTransaction' elide effective t = where showposting p = showacct p ++ " " ++ (showamount $ pamount p) ++ (showcomment $ pcomment p) showpostingnoamt p = rstrip $ showacct p ++ " " ++ (showcomment $ pcomment p) - showacct p = " " ++ showstatus p ++ (printf "%-34s" $ showAccountName (Just 34) (ptype p) (paccount 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 showcomment s = if (length s) > 0 then " ; "++s else "" showstatus p = if pstatus p then "* " else ""