* Replace newlines in table output with spaces.
This commit is contained in:
parent
749dd97a54
commit
c6890d6b5c
|
@ -930,7 +930,7 @@ void printTable(Table & table)
|
||||||
vector<unsigned int> widths;
|
vector<unsigned int> widths;
|
||||||
widths.resize(nrColumns);
|
widths.resize(nrColumns);
|
||||||
|
|
||||||
for (Table::iterator i = table.begin(); i != table.end(); ++i) {
|
foreach (Table::iterator, i, table) {
|
||||||
assert(i->size() == nrColumns);
|
assert(i->size() == nrColumns);
|
||||||
Strings::iterator j;
|
Strings::iterator j;
|
||||||
unsigned int column;
|
unsigned int column;
|
||||||
|
@ -938,14 +938,15 @@ void printTable(Table & table)
|
||||||
if (j->size() > widths[column]) widths[column] = j->size();
|
if (j->size() > widths[column]) widths[column] = j->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Table::iterator i = table.begin(); i != table.end(); ++i) {
|
foreach (Table::iterator, i, table) {
|
||||||
Strings::iterator j;
|
Strings::iterator j;
|
||||||
unsigned int column;
|
unsigned int column;
|
||||||
for (j = i->begin(), column = 0; j != i->end(); ++j, ++column)
|
for (j = i->begin(), column = 0; j != i->end(); ++j, ++column) {
|
||||||
{
|
string s = *j;
|
||||||
cout << *j;
|
replace(s.begin(), s.end(), '\n', ' ');
|
||||||
|
cout << s;
|
||||||
if (column < nrColumns - 1)
|
if (column < nrColumns - 1)
|
||||||
cout << string(widths[column] - j->size() + 2, ' ');
|
cout << string(widths[column] - s.size() + 2, ' ');
|
||||||
}
|
}
|
||||||
cout << std::endl;
|
cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue