Merge pull request #104 from csrhodes/next

justification
This commit is contained in:
John Wiegley 2012-11-06 12:49:09 -08:00
commit 3a766aa7c5
2 changed files with 12 additions and 9 deletions

View file

@ -530,9 +530,11 @@ bool display_filter_posts::output_rounding(post_t& post)
} }
// Allow the posting to be displayed if: // Allow the posting to be displayed if:
// 1. It's display_amount would display as non-zero // 1. Its display_amount would display as non-zero, or
// 2. The --empty option was specified // 2. The --empty option was specified, or
// 3. The account of the posting is <Revalued> // 3. a) The account of the posting is <Revalued>, and
// b) the revalued option is specified, and
// c) the --no-rounding option is not specified.
if (post.account == revalued_account) { if (post.account == revalued_account) {
if (show_rounding) if (show_rounding)

View file

@ -203,9 +203,15 @@ namespace {
(static_cast<std::string::size_type>(account_width) - (static_cast<std::string::size_type>(account_width) -
static_cast<std::string::size_type>(name.length())); 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; string amt;
if (post->amount_expr) { 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 && else if (count == 2 && index == 2 &&
post_has_simple_amount(*post) && post_has_simple_amount(*post) &&
@ -218,11 +224,6 @@ namespace {
// first. // first.
} }
else { 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; std::ostringstream amt_str;
value_t(post->amount).print(amt_str, static_cast<int>(amount_width), value_t(post->amount).print(amt_str, static_cast<int>(amount_width),
-1, AMOUNT_PRINT_RIGHT_JUSTIFY | -1, AMOUNT_PRINT_RIGHT_JUSTIFY |