You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If available (since Win10) using ENABLE_VIRTUAL_TERMINAL_PROCESSING output mode to process ANSI Escape Sequences. On older Windows versions it keeps using the ANSI emulation like before.
It's possible to disable use of ENABLE_VIRTUAL_TERMINAL_PROCESSING mode by defining FORCE_ANSI_ESC_EMULATION_ON_WINDOWS compiler definition.
Related documentation: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
Known issues:
The VIRTUAL_TERMINAL_PROCESSING mode is not handling escape codes for hiding input (^[[8m and ^[[28m), which is currently used in ASK/HIDE function. As these sequences are also not fully supported on some POSIX systems, the hiding input should be solved using other way.
metaeducation/rebol-issues#476
// While the line editor is running with ENABLE_LINE_INPUT, there
278
332
// are very few hooks offered.
279
333
//
280
-
SetConsoleMode(Std_Inp, CONSOLE_MODES);
334
+
DWORDdwInpMode=CONSOLE_MODES;
335
+
DWORDdwOutMode=dwOriginalOutMode;
336
+
337
+
if(!SetConsoleMode(Std_Inp, dwInpMode)) {
338
+
printf("Failed to set input ConsoleMode! Error: %i\n", GetLastError());
339
+
returnDR_ERROR;
340
+
}
341
+
342
+
if(!Emulate_ANSI) {
343
+
//dwInpMode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
344
+
dwOutMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
345
+
if (SetConsoleMode(Std_Out, dwOutMode)) {
346
+
//SetConsoleMode(Std_Inp, dwInpMode);
347
+
} else {
348
+
Emulate_ANSI=1; // failed to use VIRTUAL_TERMINAL_PROCESSING, so force emulation
349
+
}
350
+
}
351
+
352
+
// Try some Set Graphics Rendition (SGR) terminal escape sequences
353
+
/*
354
+
wprintf(L"\x1b[31mThis text has a red foreground using SGR.31.\r\n");
355
+
wprintf(L"\x1b[1mThis text has a bright (bold) red foreground using SGR.1 to affect the previous color setting.\r\n");
356
+
wprintf(L"\x1b[mThis text has returned to default colors using SGR.0 implicitly.\r\n");
357
+
wprintf(L"\x1b[34;46mThis text shows the foreground and background change at the same time.\r\n");
358
+
wprintf(L"\x1b[0mThis text has returned to default colors using SGR.0 explicitly.\r\n");
359
+
wprintf(L"\x1b[31;32;33;34;35;36;101;102;103;104;105;106;107mThis text attempts to apply many colors in the same command. Note the colors are applied from left to right so only the right-most option of foreground cyan (SGR.36) and background bright white (SGR.107) is effective.\r\n");
360
+
wprintf(L"\x1b[39mThis text has restored the foreground color only.\r\n");
361
+
wprintf(L"\x1b[49mThis text has restored the background color only.\r\n");
0 commit comments