From 562b54839cd42b5e3280cbf4444e392d503e6b77 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 28 Oct 2024 01:58:47 +0300 Subject: [PATCH] engine: client: console: fix printing multiline messages with CRLF, like HTTP headers --- engine/client/console.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/engine/client/console.c b/engine/client/console.c index 3285c585..f72b0779 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -875,7 +875,6 @@ void Con_Print( const char *txt ) Con_DeleteLastLine(); cr_pending = 0; } - c = *txt; switch( c ) @@ -883,10 +882,13 @@ void Con_Print( const char *txt ) case '\0': break; case '\r': - Con_AddLine( buf, bufpos, true ); - lastlength = CON_LINES_LAST().length; - cr_pending = 1; - bufpos = 0; + if( txt[1] != '\n' ) + { + Con_AddLine( buf, bufpos, true ); + lastlength = CON_LINES_LAST().length; + cr_pending = 1; + bufpos = 0; + } break; case '\n': Con_AddLine( buf, bufpos, true ); @@ -894,6 +896,7 @@ void Con_Print( const char *txt ) bufpos = 0; break; default: + buf[bufpos++] = c | mask; if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 )) {