===========================================================================
| 1337 | |
| 1338 | //=========================================================================== |
| 1339 | void DrawConsoleInput () |
| 1340 | { |
| 1341 | DebuggerSetColorFG( DebuggerGetColor( FG_CONSOLE_INPUT )); |
| 1342 | DebuggerSetColorBG( DebuggerGetColor( BG_CONSOLE_INPUT )); |
| 1343 | |
| 1344 | RECT rect; |
| 1345 | GetConsoleRect( 0, rect ); |
| 1346 | |
| 1347 | // For long input only show last g_nConsoleInputScrollWidth characters |
| 1348 | if (g_nConsoleInputChars > g_nConsoleInputScrollWidth) |
| 1349 | { |
| 1350 | assert(g_nConsoleInputScrollWidth <= CONSOLE_WIDTH); // NOTE: To support a wider input line the size of g_aConsoleInput[] must be increased |
| 1351 | |
| 1352 | // g_nConsoleInputMaxLen = 16; |
| 1353 | // g_nConsoleInputScrollWidth = 10; |
| 1354 | // |
| 1355 | // 123456789ABCDEF g_aConsoleInput[] |
| 1356 | // ^ g_nConsoleInputChars = 15 |
| 1357 | // [--------] g_nConsoleInputScrollWidth = 10 |
| 1358 | // >6789ABCDEF_ g_nConsoleInputMaxLen = 16 |
| 1359 | static char aScrollingInput[ CONSOLE_WIDTH+1 ]; |
| 1360 | aScrollingInput[0] = g_aConsoleInput[0]; // 1. Start-of-Line |
| 1361 | |
| 1362 | const int nInputOffset = g_nConsoleInputChars - g_nConsoleInputScrollWidth ; // 2. Middle |
| 1363 | const int nInputWidth = min( g_nConsoleInputChars, g_nConsoleInputScrollWidth ); // NOTE: Keep in Sync! DrawConsoleInput() and DrawConsoleCursor() |
| 1364 | strncpy( aScrollingInput+1, g_aConsoleInput + 1 + nInputOffset, nInputWidth ); // +1 to skip prompt |
| 1365 | |
| 1366 | aScrollingInput[ g_nConsoleInputScrollWidth+1 ] = 0; // 3. End-of-Line leave room for cursor |
| 1367 | |
| 1368 | PrintText( aScrollingInput, rect ); |
| 1369 | } |
| 1370 | else |
| 1371 | PrintText( g_aConsoleInput, rect ); |
| 1372 | } |
| 1373 | |
| 1374 | |
| 1375 | //=========================================================================== |
no test coverage detected