From 2d6b68edd8f5fde93e997062a8672c53c99277a5 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 10 Jan 2013 16:29:54 -0600 Subject: [PATCH] Fix win32 console partial print being overwritten --- code/sys/con_win32.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/sys/con_win32.c b/code/sys/con_win32.c index 990d55da..edfa4e6a 100644 --- a/code/sys/con_win32.c +++ b/code/sys/con_win32.c @@ -42,6 +42,7 @@ static int qconsole_history_oldest = 0; // current edit buffer static char qconsole_line[ MAX_EDIT_LINE ]; static int qconsole_linelen = 0; +static qboolean qconsole_drawinput = qtrue; static HANDLE qconsole_hout; static HANDLE qconsole_hin; @@ -181,6 +182,10 @@ static void CON_Show( void ) GetConsoleScreenBufferInfo( qconsole_hout, &binfo ); + // if we're in the middle of printf, don't bother writing the buffer + if( !qconsole_drawinput ) + return; + writeArea.Left = 0; writeArea.Top = binfo.dwCursorPosition.Y; writeArea.Bottom = binfo.dwCursorPosition.Y; @@ -424,6 +429,8 @@ void CON_WindowsColorPrint( const char *msg ) while( *msg ) { + qconsole_drawinput = ( *msg == '\n' ); + if( Q_IsColorString( msg ) || *msg == '\n' ) { // First empty the buffer