From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 6F27F3858D1E; Fri, 11 Feb 2022 00:11:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F27F3858D1E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Maintain ENABLE_(INSERT|QUICK_EDIT)_MODE flags. X-Act-Checkin: newlib-cygwin X-Git-Author: Mitchell Hentges X-Git-Refname: refs/heads/master X-Git-Oldrev: 8f2bd6f046cf2c7a6d7332bf056ebdb294077747 X-Git-Newrev: 8a95249d738cd46299c72a5da8150b4bba0a7e95 Message-Id: <20220211001147.6F27F3858D1E@sourceware.org> Date: Fri, 11 Feb 2022 00:11:47 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2022 00:11:47 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D8a95249d738= cd46299c72a5da8150b4bba0a7e95 commit 8a95249d738cd46299c72a5da8150b4bba0a7e95 Author: Mitchell Hentges Date: Thu Feb 10 10:38:08 2022 -0500 Cygwin: console: Maintain ENABLE_(INSERT|QUICK_EDIT)_MODE flags. =20 - Currently, ENABLE_INSERT_MODE and ENABLE_QUICK_EDIT_MODE are cleared if cygwin is started in console. These flags will not be recovered even when exiting from cygwin. Also note that if ENABLE_EXTENDED_FLAGS is once unset, then the flag ENABLE_QUICK_EDIT_MODE it's associated with will no longer be preserved. Unfortunately, we're accidentally stepping on this in fhandler_console::set_input_mode(). =20 This patch solves this by carrying forward these flags in the place where it had been ignoring them. Since the previous behaviour of leaving these flags unset would essentially maintain their existing state, adding the carry-over of the flags now should not alter console behaviour. Diff: --- winsup/cygwin/fhandler_console.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_con= sole.cc index 7a1a45bc1..b28dd66f5 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -458,16 +458,18 @@ void fhandler_console::set_input_mode (tty::cons_mode m, const termios *t, const handle_set_t *p) { - DWORD flags =3D 0, oflags; + DWORD oflags; WaitForSingleObject (p->input_mutex, mutex_timeout); GetConsoleMode (p->input_handle, &oflags); + DWORD flags =3D oflags + & (ENABLE_EXTENDED_FLAGS | ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE= ); switch (m) { case tty::restore: - flags =3D ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_I= NPUT; + flags |=3D ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_= INPUT; break; case tty::cygwin: - flags =3D ENABLE_WINDOW_INPUT; + flags |=3D ENABLE_WINDOW_INPUT; if (wincap.has_con_24bit_colors () && !con_is_legacy) flags |=3D ENABLE_VIRTUAL_TERMINAL_INPUT; else