Justify integers correctly when printing
This commit is contained in:
parent
bfa2691583
commit
4fe4a33bf8
1 changed files with 8 additions and 6 deletions
14
src/value.cc
14
src/value.cc
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue