mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-03 21:45:51 +08:00
Cygwin: console: Retain ENABLE_VIRTUAL_TERMIANL_PROCESSING flag.
- Currently, ENABLE_VIRTUAL_TERMINAL_PROCESSING flag is disabled unconditionally when exiting from cygwin. This causes ANSI escape sequence disabled in Windows Terminal where it is enables by default. This patch retains that flag if it is originally enabled.
This commit is contained in:
parent
ddce45112d
commit
fdbd153932
@ -2022,6 +2022,7 @@ class dev_console
|
||||
{
|
||||
pid_t owner;
|
||||
bool is_legacy;
|
||||
bool orig_virtual_terminal_processing_mode;
|
||||
|
||||
WORD default_color, underline_color, dim_color;
|
||||
|
||||
|
@ -597,6 +597,8 @@ fhandler_console::set_output_mode (tty::cons_mode m, const termios *t,
|
||||
const handle_set_t *p)
|
||||
{
|
||||
DWORD flags = ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT;
|
||||
if (con.orig_virtual_terminal_processing_mode)
|
||||
flags |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
WaitForSingleObject (p->output_mutex, mutex_timeout);
|
||||
switch (m)
|
||||
{
|
||||
@ -1505,6 +1507,8 @@ fhandler_console::open (int flags, mode_t)
|
||||
/* Check xterm compatible mode in output */
|
||||
acquire_attach_mutex (mutex_timeout);
|
||||
GetConsoleMode (get_output_handle (), &dwMode);
|
||||
con.orig_virtual_terminal_processing_mode =
|
||||
!!(dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||
if (!SetConsoleMode (get_output_handle (),
|
||||
dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING))
|
||||
is_legacy = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user