diff --git a/Commands/Register.hs b/Commands/Register.hs index 43e528353..69b6c6897 100644 --- a/Commands/Register.hs +++ b/Commands/Register.hs @@ -135,7 +135,7 @@ showposting withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] + datewidth = 10 descwidth = datedescwidth - datewidth - 2 desc = printf ("%-"++(show descwidth)++"s") $ elideRight descwidth de :: String - pstr = showPostingWithoutPrice p + pstr = showPostingForRegister p bal = padleft 12 (showMixedAmountOrZeroWithoutPrice b) (da,de) = case ptransaction p of Just (Transaction{tdate=da',tdescription=de'}) -> (da',de') Nothing -> (nulldate,"") diff --git a/hledger-lib/Ledger/Posting.hs b/hledger-lib/Ledger/Posting.hs index 662d1ebc5..b296d204c 100644 --- a/hledger-lib/Ledger/Posting.hs +++ b/hledger-lib/Ledger/Posting.hs @@ -34,8 +34,8 @@ showPosting (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) = showamount = padleft 12 . showMixedAmountOrZero comment = if null com then "" else " ; " ++ com -- XXX refactor -showPostingWithoutPrice (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) = - concatTopPadded [showaccountname a ++ " ", showamount amt, comment] +showPostingForRegister (Posting{paccount=a,pamount=amt,ptype=t}) = + concatTopPadded [showaccountname a ++ " ", showamount amt] where ledger3ishlayout = False acctnamewidth = if ledger3ishlayout then 25 else 22 @@ -45,7 +45,6 @@ showPostingWithoutPrice (Posting{paccount=a,pamount=amt,pcomment=com,ptype=t}) = VirtualPosting -> (\s -> "("++s++")", acctnamewidth-2) _ -> (id,acctnamewidth) showamount = padleft 12 . showMixedAmountOrZeroWithoutPrice - comment = if null com then "" else " ; " ++ com isReal :: Posting -> Bool isReal p = ptype p == RegularPosting diff --git a/tests/print-posting-comment.test b/tests/print-posting-comment.test new file mode 100644 index 000000000..38217efe2 --- /dev/null +++ b/tests/print-posting-comment.test @@ -0,0 +1,13 @@ +# a posting comment should appear in print +-f - print +<<< +2010/01/01 x + a 1 ; comment + b -1 + +>>> +2010/01/01 x + a 1 ; comment + b -1 + +>>>2 diff --git a/tests/register-posting-comment.test b/tests/register-posting-comment.test new file mode 100644 index 000000000..2903646f0 --- /dev/null +++ b/tests/register-posting-comment.test @@ -0,0 +1,11 @@ +# a posting comment should not appear in register +-f - register +<<< +2010/1/1 x + a 1 ; comment + b + +>>> +2010/01/01 x a 1 1 + b -1 0 +>>>2