summaryrefslogtreecommitdiff
path: root/src/report.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-05-22 19:17:13 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-05-22 21:35:03 -0400
commita7c28aa20057525a9247d0ae69eb063b53b21811 (patch)
tree8c2ca8592f7de44a4e8d785cedc869fa32f0bbf0 /src/report.h
parentdb5418c8386e4a1a1b72e0bcdba2eeb22f99b96f (diff)
downloadfork-ledger-a7c28aa20057525a9247d0ae69eb063b53b21811.tar.gz
fork-ledger-a7c28aa20057525a9247d0ae69eb063b53b21811.tar.bz2
fork-ledger-a7c28aa20057525a9247d0ae69eb063b53b21811.zip
Added new option --prepend-width
This is useful for making sure that the column containing the results of --prepend-format is a consistent width throughout the report (including those lines where it is not applied). Fixes 64F9D913-75E1-4830-A3D9-29B72442E68B
Diffstat (limited to 'src/report.h')
-rw-r--r--src/report.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/report.h b/src/report.h
index df2f3469..64c14858 100644
--- a/src/report.h
+++ b/src/report.h
@@ -280,6 +280,7 @@ public:
HANDLER(plot_amount_format_).report(out);
HANDLER(plot_total_format_).report(out);
HANDLER(prepend_format_).report(out);
+ HANDLER(prepend_width_).report(out);
HANDLER(price).report(out);
HANDLER(prices_format_).report(out);
HANDLER(pricedb_format_).report(out);
@@ -372,7 +373,7 @@ public:
OPTION__(report_t, balance_format_, CTOR(report_t, balance_format_) {
on(none,
- "%(justify(scrub(display_total), 20, -1, true, color))"
+ "%(justify(scrub(display_total), 20, 20 + prepend_width, true, color))"
" %(!options.flat ? depth_spacer : \"\")"
"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
"%$1\n%/"
@@ -432,8 +433,9 @@ public:
OPTION__(report_t, cleared_format_, CTOR(report_t, cleared_format_) {
on(none,
- "%(justify(scrub(get_at(total_expr, 0)), 16, -1, true, color))"
- " %(justify(scrub(get_at(total_expr, 1)), 16, -1, true, color))"
+ "%(justify(scrub(get_at(total_expr, 0)), 16, 16 + prepend_width, "
+ " true, color)) %(justify(scrub(get_at(total_expr, 1)), 18, "
+ " 36 + prepend_width, true, color))"
" %(latest_cleared ? format_date(latest_cleared) : \" \")"
" %(!options.flat ? depth_spacer : \"\")"
"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
@@ -737,6 +739,9 @@ public:
});
OPTION(report_t, prepend_format_);
+ OPTION_(report_t, prepend_width_, DO_(args) {
+ value = args[1].to_long();
+ });
OPTION_(report_t, price, DO() { // -I
parent->HANDLER(display_amount_)
@@ -784,10 +789,10 @@ public:
" account_width), blue if color))"
" %(justify(scrub(display_amount), amount_width, "
" 3 + meta_width + date_width + payee_width + account_width"
- " + amount_width, true, color))"
+ " + amount_width + prepend_width, true, color))"
" %(justify(scrub(display_total), total_width, "
" 4 + meta_width + date_width + payee_width + account_width"
- " + amount_width + total_width, true, color))\n%/"
+ " + amount_width + total_width + prepend_width, true, color))\n%/"
"%(justify(\" \", 2 + date_width + payee_width))"
"%$3 %$4 %$5\n");
});