public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: console: Retain ENABLE_VIRTUAL_TERMIANL_PROCESSING flag. Date: Wed, 15 Jun 2022 04:38:05 +0000 (GMT) [thread overview] Message-ID: <20220615043805.1A362385829F@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e4fdb0cb73cc48a2db473b525b6ba0a33ecabf97 commit e4fdb0cb73cc48a2db473b525b6ba0a33ecabf97 Author: Takashi Yano <takashi.yano@nifty.ne.jp> Date: Tue Jun 14 21:01:58 2022 +0900 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. Diff: --- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_console.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 2ff99aeae..9940da771 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -2021,6 +2021,7 @@ class dev_console { pid_t owner; bool is_legacy; + bool orig_virtual_terminal_processing_mode; WORD default_color, underline_color, dim_color; diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index e84823685..5adf0b8e4 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -596,6 +596,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) { @@ -1503,6 +1505,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;
reply other threads:[~2022-06-15 4:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220615043805.1A362385829F@sourceware.org \ --to=tyan0@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).