about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-07-02T08·52+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-07-02T08·52+0000
commitc6890d6b5cf6bb57afd6431382a6459eee47f5b3 (patch)
tree14d6f99fb860a30d6ec47a61323cf2c56f6e33f2
parent749dd97a54f50467d266dde2b833f272cb556145 (diff)
* Replace newlines in table output with spaces.
-rw-r--r--src/nix-env/nix-env.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 87887a7bd570..cb3fffc485ad 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -930,7 +930,7 @@ void printTable(Table & table)
     vector<unsigned int> widths;
     widths.resize(nrColumns);
     
-    for (Table::iterator i = table.begin(); i != table.end(); ++i) {
+    foreach (Table::iterator, i, table) {
         assert(i->size() == nrColumns);
         Strings::iterator j;
         unsigned int column;
@@ -938,14 +938,15 @@ void printTable(Table & table)
             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;
         unsigned int column;
-        for (j = i->begin(), column = 0; j != i->end(); ++j, ++column)
-        {
-            cout << *j;
+        for (j = i->begin(), column = 0; j != i->end(); ++j, ++column) {
+            string s = *j;
+            replace(s.begin(), s.end(), '\n', ' ');
+            cout << s;
             if (column < nrColumns - 1)
-                cout << string(widths[column] - j->size() + 2, ' ');
+                cout << string(widths[column] - s.size() + 2, ' ');
         }
         cout << std::endl;
     }