[grid_layout] avoid extra newline at end of grid
This commit is contained in:
parent
d19164a177
commit
d858a43f07
@ -20,12 +20,21 @@ grid_layout::render(ostream &out) const
|
|||||||
calc_field_widths(widths);
|
calc_field_widths(widths);
|
||||||
|
|
||||||
grid::const_iterator row;
|
grid::const_iterator row;
|
||||||
|
bool newline_needed = false;
|
||||||
|
|
||||||
for (row = grid_.begin(); row != grid_.end(); ++row) {
|
for (row = grid_.begin(); row != grid_.end(); ++row) {
|
||||||
row::const_iterator col;
|
row::const_iterator col;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (col = row->begin(), i = 0; col != row->end(); ++col, ++i)
|
|
||||||
|
if (newline_needed) {
|
||||||
|
out << "\n";
|
||||||
|
newline_needed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (col = row->begin(), i = 0; col != row->end(); ++col, ++i) {
|
||||||
out << justify(widths[i], *col) << " ";
|
out << justify(widths[i], *col) << " ";
|
||||||
out << "\n";
|
newline_needed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user