diff --git a/hledger/Hledger/Cli/Balance.hs b/hledger/Hledger/Cli/Balance.hs index dfb9d99a5..2c9cea415 100644 --- a/hledger/Hledger/Cli/Balance.hs +++ b/hledger/Hledger/Cli/Balance.hs @@ -480,8 +480,7 @@ multiBalanceReportAsCsv opts (MultiBalanceReport (colspans, items, (coltotals,to -- | Render a multi-column balance report as plain text suitable for console output. multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String multiBalanceReportAsText opts r = - printf "%s in %s:" typeStr (showDateSpan $ multiBalanceReportSpan r) - ++ "\n" + printf "%s in %s:\n\n" typeStr (showDateSpan $ multiBalanceReportSpan r) ++ renderBalanceReportTable opts tabl where tabl = balanceReportAsTable opts r @@ -495,11 +494,16 @@ multiBalanceReportAsText opts r = -- made using 'balanceReportAsTable'), render it in a format suitable for -- console output. renderBalanceReportTable :: ReportOpts -> Table String String MixedAmount -> String -renderBalanceReportTable (ReportOpts { pretty_tables_ = pretty, color_=usecolor }) = unlines . trimborder . lines - . render pretty id (" " ++) showamt - . align +renderBalanceReportTable (ReportOpts { pretty_tables_ = pretty, color_=usecolor }) = + unlines + . addtrailingblank + . trimborder + . lines + . render pretty id (" " ++) showamt + . align where - trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init) + addtrailingblank = (++[""]) + trimborder = drop 1 . init . map (drop 1 . init) align (Table l t d) = Table l' t d where acctswidth = maximum' $ map strWidth (headerContents l) diff --git a/hledger/Hledger/Cli/CompoundBalanceCommand.hs b/hledger/Hledger/Cli/CompoundBalanceCommand.hs index b9c5862b2..61901530b 100644 --- a/hledger/Hledger/Cli/CompoundBalanceCommand.hs +++ b/hledger/Hledger/Cli/CompoundBalanceCommand.hs @@ -155,8 +155,8 @@ compoundBalanceCommand CompoundBalanceCommandSpec{..} CliOpts{command_=cmd, repo ++ (if average_ ropts' then [overallaverage] else []) where overallaverage = overalltotal `divideMixedAmount` fromIntegral (length overalltotals) - putStrLn title - putStrLn $ renderBalanceReportTable ropts' overalltable' + putStrLn $ title ++ "\n" + putStr $ renderBalanceReportTable ropts' overalltable' -- Add the second table below the first, discarding its column headings. concatTables (Table hLeft hTop dat) (Table hLeft' _ dat') = diff --git a/tests/balancesheet/balancesheet.test b/tests/balancesheet/balancesheet.test index 4d699812d..22fae31bc 100644 --- a/tests/balancesheet/balancesheet.test +++ b/tests/balancesheet/balancesheet.test @@ -45,7 +45,6 @@ Balance Sheet ======================++================================================================================================================================================= Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 - >>>=0 # 3. @@ -74,7 +73,6 @@ Balance Sheet ==============++================================================================================================================================================= Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 - >>>= 0 # 4. @@ -100,7 +98,6 @@ Balance Sheet ======================++========================================================================================================================================================== Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 0 - >>>= 0 # 5. @@ -124,7 +121,6 @@ Balance Sheet ----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------- || 0 0 0 0 0 0 0 0 0 0 0 $1 $1 - >>>= 0 # 6. Tree output still works, #565 @@ -197,7 +193,6 @@ Balance Sheet =============++=============================== Total || $1 $1 $1 - >>>2 >>>=0 @@ -225,6 +220,5 @@ Balance Sheet ═════════════╬═════════════ Total ║ 1 - >>>2 >>>= 0 diff --git a/tests/cashflow/cashflow.test b/tests/cashflow/cashflow.test index c3ae3d3d7..64952f7f5 100644 --- a/tests/cashflow/cashflow.test +++ b/tests/cashflow/cashflow.test @@ -161,7 +161,6 @@ Cashflow Statement ----------------------++------------------------------------------------------------------------------------------------------------- || $1 0 0 0 0 $-1 0 0 0 0 0 $-1 - >>>= 0 # 7. Multicolumn test (historical) @@ -179,7 +178,6 @@ Cashflow Statement (Historical Ending Balances) ----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------- || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1 0 - >>>= 0 # 8. without -N/--no-total (single column) @@ -224,7 +222,6 @@ Cashflow Statement --------------------++------- || $-1 - >>>2 >>>= 0 @@ -240,6 +237,5 @@ Cashflow Statement assets:bank:saving || $1 assets:cash || $-2 - >>>2 >>>= 0 diff --git a/tests/incomestatement/incomestatement.test b/tests/incomestatement/incomestatement.test index c99ce0c20..eb37707a9 100644 --- a/tests/incomestatement/incomestatement.test +++ b/tests/incomestatement/incomestatement.test @@ -208,7 +208,6 @@ Income Statement ===================++=============================================================================================================================== Total || $-1 0 0 0 0 $1 0 0 0 0 0 0 0 0 - >>>= 0 # 6. Multicolumn test (historical) @@ -234,5 +233,4 @@ Income Statement (Historical Ending Balances) ===================++================================================================================================================================================= Total || $-1 $-1 $-1 $-1 $-1 0 0 0 0 0 0 0 - >>>= 0