summaryrefslogtreecommitdiff
path: root/src/print.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-05-07 23:16:45 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-05-07 23:16:45 -0400
commit4028f0bcb455ce4ea23c355b6a43dc6122447a78 (patch)
treee7e418087b150c03daa43662076fa8f03c6ea03b /src/print.cc
parentd0460b06924ce9a25953247ee1c6049d6d0a2d36 (diff)
downloadfork-ledger-4028f0bcb455ce4ea23c355b6a43dc6122447a78.tar.gz
fork-ledger-4028f0bcb455ce4ea23c355b6a43dc6122447a78.tar.bz2
fork-ledger-4028f0bcb455ce4ea23c355b6a43dc6122447a78.zip
print command correctly prints amount expressions
Diffstat (limited to 'src/print.cc')
-rw-r--r--src/print.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/print.cc b/src/print.cc
index eb102a87..34f5af51 100644
--- a/src/print.cc
+++ b/src/print.cc
@@ -140,9 +140,15 @@ namespace {
if (slip > 0)
out << string(slip, ' ');
- std::ostringstream amt_str;
- report.scrub(post->amount).print(amt_str, 12, -1, true);
- string amt = amt_str.str();
+ string amt;
+ if (post->amount_expr) {
+ amt = post->amount_expr->text();
+ } else {
+ std::ostringstream amt_str;
+ report.scrub(post->amount).print(amt_str, 12, -1, true);
+ amt = amt_str.str();
+ }
+
string trimmed_amt(amt);
trim_left(trimmed_amt);
int amt_slip = (static_cast<int>(amt.length()) -