From 4fe4a33bf85ca6e8c30c5cfe42ad33db3cd5b841 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 21 Feb 2009 00:45:54 -0400 Subject: [PATCH] Justify integers correctly when printing --- src/value.cc | 14 ++++++++------ 1 file 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; }