diff --git a/Commands/Register.hs b/Commands/Register.hs index 3b3bd0147..f97deb996 100644 --- a/Commands/Register.hs +++ b/Commands/Register.hs @@ -106,9 +106,13 @@ showtxns (t:ts) tprev bal = this ++ showtxns ts t bal' showtxn :: Bool -> Transaction -> MixedAmount -> String showtxn omitdesc t b = concatBottomPadded [entrydesc ++ p ++ " ", bal] ++ "\n" where - entrydesc = if omitdesc then replicate 32 ' ' else printf "%s %s " date desc + ledger3ishlayout = False + datedescwidth = if ledger3ishlayout then 34 else 32 + entrydesc = if omitdesc then replicate datedescwidth ' ' else printf "%s %s " date desc date = showDate da - desc = printf "%-20s" $ elideRight 20 de :: String + datewidth = 10 + descwidth = datedescwidth - datewidth - 2 + desc = printf ("%-"++(show descwidth)++"s") $ elideRight descwidth de :: String p = showPostingWithoutPrice $ Posting s a amt "" tt bal = padleft 12 (showMixedAmountOrZeroWithoutPrice b) Transaction{tstatus=s,tdate=da,tdescription=de,taccount=a,tamount=amt,ttype=tt} = t diff --git a/Ledger/Posting.hs b/Ledger/Posting.hs index abd5e2f2f..9f2942767 100644 --- a/Ledger/Posting.hs +++ b/Ledger/Posting.hs @@ -25,11 +25,13 @@ showPosting :: Posting -> String showPosting (Posting _ a amt com ttype) = concatTopPadded [showaccountname a ++ " ", showamount amt, comment] where - showaccountname = printf "%-22s" . bracket . elideAccountName width + ledger3ishlayout = False + acctnamewidth = if ledger3ishlayout then 25 else 22 + showaccountname = printf ("%-"++(show acctnamewidth)++"s") . bracket . elideAccountName width (bracket,width) = case ttype of - BalancedVirtualPosting -> (\s -> "["++s++"]", 20) - VirtualPosting -> (\s -> "("++s++")", 20) - _ -> (id,22) + BalancedVirtualPosting -> (\s -> "["++s++"]", acctnamewidth-2) + VirtualPosting -> (\s -> "("++s++")", acctnamewidth-2) + _ -> (id,acctnamewidth) showamount = padleft 12 . showMixedAmountOrZero comment = if null com then "" else " ; " ++ com -- XXX refactor