Justify integers correctly when printing

This commit is contained in:
John Wiegley 2009-02-21 00:45:54 -04:00
parent bfa2691583
commit 4fe4a33bf8

View file

@ -1303,16 +1303,18 @@ void value_t::print(std::ostream& out,
break; break;
case INTEGER: case INTEGER:
out << as_long(); out << std::right << as_long();
break; break;
case AMOUNT: { case AMOUNT: {
std::ostringstream buf; if (as_amount().is_zero()) {
if (as_amount().is_zero()) out.width(first_width);
buf << 0L; out << std::right << 0L;
else } else {
std::ostringstream buf;
buf << as_amount(); buf << as_amount();
justify(out, buf.str(), first_width, true); justify(out, buf.str(), first_width, true);
}
break; break;
} }