don't show more than 20 lines of redirected IO, just 10 first and last ones is enough...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 22 Mar 2008 14:49:45 +0000 (14:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 22 Mar 2008 14:49:45 +0000 (14:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/console/console.cpp

index f345fc794d4d50c58c5a13c524b04403405b084a..27016fc935cf4dbc56dd451ce861eafecd8efc5d 100644 (file)
@@ -583,12 +583,27 @@ static void TestExecute()
     }
     else
     {
-        unsigned count = output.GetCount();
-        for ( unsigned n = 0; n < count; n++ )
+        // don't show too much output, MAX_LINES is enough
+        static const unsigned MAX_LINES = 20;
+
+        const unsigned count = output.size();
+        for ( unsigned n = 0;
+              n < (count > MAX_LINES ? MAX_LINES/2 : count);
+              n++ )
         {
             wxPrintf("%04u:\t%s\n", n + 1, output[n]);
         }
 
+        if ( count > MAX_LINES )
+        {
+            wxPrintf("... skipping %u lines...\n", count - MAX_LINES);
+
+            for ( unsigned n = count - MAX_LINES/2; n < count; n++ )
+            {
+                wxPrintf("%04u:\t%s\n", n + 1, output[n]);
+            }
+        }
+
         wxPuts(_T("Ok."));
     }
 }