summaryrefslogtreecommitdiff
path: root/src/print.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/print.cc')
-rw-r--r--src/print.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/print.cc b/src/print.cc
index 79d83161..f04f59d5 100644
--- a/src/print.cc
+++ b/src/print.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003-2012, John Wiegley. All rights reserved.
+ * Copyright (c) 2003-2013, John Wiegley. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -203,9 +203,15 @@ namespace {
(static_cast<std::string::size_type>(account_width) -
static_cast<std::string::size_type>(name.length()));
+ std::size_t amount_width =
+ (report.HANDLED(amount_width_) ?
+ lexical_cast<std::size_t>(report.HANDLER(amount_width_).str()) :
+ 12);
string amt;
if (post->amount_expr) {
- amt = post->amount_expr->text();
+ std::ostringstream amt_str;
+ justify(amt_str, post->amount_expr->text(), amount_width, true);
+ amt = amt_str.str();
}
else if (count == 2 && index == 2 &&
post_has_simple_amount(*post) &&
@@ -218,11 +224,6 @@ namespace {
// first.
}
else {
- std::size_t amount_width =
- (report.HANDLED(amount_width_) ?
- lexical_cast<std::size_t>(report.HANDLER(amount_width_).str()) :
- 12);
-
std::ostringstream amt_str;
value_t(post->amount).print(amt_str, static_cast<int>(amount_width),
-1, AMOUNT_PRINT_RIGHT_JUSTIFY |