From c1ddacf5be364a13b48910a16db6d92de6ca6461 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 10 Jan 2013 15:06:59 -0600 Subject: [PATCH] Fix win32 input left on buffer and overwritten The input line on the console screen buffer was moved up a line and overwritten by CON_Print. Remove input line when console shutdown as well. --- code/sys/con_win32.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/code/sys/con_win32.c b/code/sys/con_win32.c index 037e9f76..9f2f98aa 100644 --- a/code/sys/con_win32.c +++ b/code/sys/con_win32.c @@ -221,6 +221,25 @@ static void CON_Show( void ) } } +/* +================== +CON_Hide +================== +*/ +static void CON_Hide( void ) +{ + int realLen; + + realLen = qconsole_linelen; + + // remove input line from console output buffer + qconsole_linelen = 0; + CON_Show( ); + + qconsole_linelen = realLen; +} + + /* ================== CON_Shutdown @@ -228,6 +247,7 @@ CON_Shutdown */ void CON_Shutdown( void ) { + CON_Hide( ); SetConsoleMode( qconsole_hin, qconsole_orig_mode ); SetConsoleCursorInfo( qconsole_hout, &qconsole_orig_cursorinfo ); SetConsoleTextAttribute( qconsole_hout, qconsole_attrib ); @@ -458,6 +478,8 @@ CON_Print */ void CON_Print( const char *msg ) { + CON_Hide( ); + CON_WindowsColorPrint( msg ); CON_Show( );