Skip to content

Commit

Permalink
do not print control characters if VT mode is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
rfomin committed Oct 13, 2023
1 parent 54eb621 commit 3c54649
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/i_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ verbosity_t cfg_verbosity;
#ifdef _WIN32
static HANDLE hConsole;
static DWORD OldMode;
static boolean restore_mode = false;
static boolean vt_mode_enabled = false;

static void EnableVTMode(void)
{
Expand All @@ -79,12 +79,12 @@ static void EnableVTMode(void)
return;
}

restore_mode = true;
vt_mode_enabled = true;
}

static void RestoreOldMode(void)
{
if (!restore_mode)
if (!vt_mode_enabled)
{
return;
}
Expand Down Expand Up @@ -142,7 +142,11 @@ void I_Printf(verbosity_t prio, const char *msg, ...)
break;
}

if (I_ConsoleStdout())
if (I_ConsoleStdout()
#ifdef _WIN32
&& vt_mode_enabled
#endif
)
{
switch (prio)
{
Expand Down

0 comments on commit 3c54649

Please sign in to comment.