MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / DrawConsoleInput

Function DrawConsoleInput

source/Debugger/Debugger_Display.cpp:1339–1372  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

1337
1338//===========================================================================
1339void 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//===========================================================================

Callers 2

DrawSubWindow_ConsoleFunction · 0.85
DebuggerInputConsoleCharFunction · 0.85

Calls 5

DebuggerSetColorFGFunction · 0.85
DebuggerGetColorFunction · 0.85
DebuggerSetColorBGFunction · 0.85
GetConsoleRectFunction · 0.85
PrintTextFunction · 0.85

Tested by

no test coverage detected