Make win32 console cursor visible

This commit is contained in:
Zack Middleton 2013-01-10 15:34:54 -06:00
parent c1ddacf5be
commit 20cd170993

View file

@ -174,16 +174,13 @@ static void CON_Show( void )
COORD writeSize = { MAX_EDIT_LINE, 1 }; COORD writeSize = { MAX_EDIT_LINE, 1 };
COORD writePos = { 0, 0 }; COORD writePos = { 0, 0 };
SMALL_RECT writeArea = { 0, 0, 0, 0 }; SMALL_RECT writeArea = { 0, 0, 0, 0 };
COORD cursorPos;
int i; int i;
CHAR_INFO line[ MAX_EDIT_LINE ]; CHAR_INFO line[ MAX_EDIT_LINE ];
WORD attrib; WORD attrib;
GetConsoleScreenBufferInfo( qconsole_hout, &binfo ); GetConsoleScreenBufferInfo( qconsole_hout, &binfo );
// if we're in the middle of printf, don't bother writing the buffer
if( binfo.dwCursorPosition.X != 0 )
return;
writeArea.Left = 0; writeArea.Left = 0;
writeArea.Top = binfo.dwCursorPosition.Y; writeArea.Top = binfo.dwCursorPosition.Y;
writeArea.Bottom = binfo.dwCursorPosition.Y; writeArea.Bottom = binfo.dwCursorPosition.Y;
@ -219,6 +216,12 @@ static void CON_Show( void )
WriteConsoleOutput( qconsole_hout, line, writeSize, WriteConsoleOutput( qconsole_hout, line, writeSize,
writePos, &writeArea ); writePos, &writeArea );
} }
// set curor position
cursorPos.Y = binfo.dwCursorPosition.Y;
cursorPos.X = qconsole_linelen > binfo.srWindow.Right ? binfo.srWindow.Right : qconsole_linelen;
SetConsoleCursorPosition( qconsole_hout, cursorPos );
} }
/* /*
@ -262,7 +265,6 @@ CON_Init
*/ */
void CON_Init( void ) void CON_Init( void )
{ {
CONSOLE_CURSOR_INFO curs;
CONSOLE_SCREEN_BUFFER_INFO info; CONSOLE_SCREEN_BUFFER_INFO info;
int i; int i;
@ -291,12 +293,6 @@ void CON_Init( void )
SetConsoleTitle(CLIENT_WINDOW_TITLE " Dedicated Server Console"); SetConsoleTitle(CLIENT_WINDOW_TITLE " Dedicated Server Console");
// make cursor invisible
GetConsoleCursorInfo( qconsole_hout, &qconsole_orig_cursorinfo );
curs.dwSize = 1;
curs.bVisible = FALSE;
SetConsoleCursorInfo( qconsole_hout, &curs );
// initialize history // initialize history
for( i = 0; i < QCONSOLE_HISTORY; i++ ) for( i = 0; i < QCONSOLE_HISTORY; i++ )
qconsole_history[ i ][ 0 ] = '\0'; qconsole_history[ i ][ 0 ] = '\0';