X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42c46d5283f413e239250c70328fce4053cfc090..69328170cc55c9b36ae0aac40b24ba51ed4f871e:/samples/console/console.cpp diff --git a/samples/console/console.cpp b/samples/console/console.cpp index 73f48d3279..27016fc935 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -539,7 +539,7 @@ static void TestExecute() #define COMMAND "echo hi" #define ASYNC_COMMAND "xclock" #define SHELL_COMMAND "echo hi from shell" - #define REDIRECT_COMMAND COMMAND "cat -n Makefile" + #define REDIRECT_COMMAND "cat -n Makefile" #elif defined(__WXMSW__) #define COMMAND "command.com /c echo hi" #define ASYNC_COMMAND "notepad" @@ -583,10 +583,25 @@ 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("%04u:\t%s\n", n, output[n]); + 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."));