From 2e6db2db1a74aa16098b60582fa3c6dfe5b2ec86 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 10 Jan 2013 15:06:59 -0600 Subject: 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. --- src/sys/con_win32.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/sys/con_win32.c b/src/sys/con_win32.c index 51b9e373..37621210 100644 --- a/src/sys/con_win32.c +++ b/src/sys/con_win32.c @@ -222,6 +222,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 @@ -229,6 +248,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 ); @@ -459,6 +479,8 @@ CON_Print */ void CON_Print( const char *msg ) { + CON_Hide( ); + CON_WindowsColorPrint( msg ); CON_Show( ); -- cgit