diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-21 00:45:54 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-21 00:45:54 -0400 |
commit | 4fe4a33bf85ca6e8c30c5cfe42ad33db3cd5b841 (patch) | |
tree | 47892ea66c7e38675df63bbc85ca6b9d2d54715a /src | |
parent | bfa2691583f92ce3b7ff346fe55253ff0391dafc (diff) | |
download | fork-ledger-4fe4a33bf85ca6e8c30c5cfe42ad33db3cd5b841.tar.gz fork-ledger-4fe4a33bf85ca6e8c30c5cfe42ad33db3cd5b841.tar.bz2 fork-ledger-4fe4a33bf85ca6e8c30c5cfe42ad33db3cd5b841.zip |
Justify integers correctly when printing
Diffstat (limited to 'src')
-rw-r--r-- | src/value.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/value.cc b/src/value.cc index d04e5ef9..a7d3c7e5 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1303,16 +1303,18 @@ void value_t::print(std::ostream& out, break; case INTEGER: - out << as_long(); + out << std::right << as_long(); break; case AMOUNT: { - std::ostringstream buf; - if (as_amount().is_zero()) - buf << 0L; - else + if (as_amount().is_zero()) { + out.width(first_width); + out << std::right << 0L; + } else { + std::ostringstream buf; buf << as_amount(); - justify(out, buf.str(), first_width, true); + justify(out, buf.str(), first_width, true); + } break; } |