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;
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;
}