From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 0BF213858D35; Tue, 2 Nov 2021 14:47:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BF213858D35 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Fix a bug on input when signalled. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 045ce20177d64e14ae398a978687d56c35173365 X-Git-Newrev: 561767fc5942746bf52c4b9f630e6a79659896a0 Message-Id: <20211102144715.0BF213858D35@sourceware.org> Date: Tue, 2 Nov 2021 14:47:15 +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: Tue, 02 Nov 2021 14:47:15 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=561767fc5942746bf52c4b9f630e6a79659896a0 commit 561767fc5942746bf52c4b9f630e6a79659896a0 Author: Takashi Yano Date: Tue Nov 2 12:40:10 2021 +0900 Cygwin: console: Fix a bug on input when signalled. - This patch fixes the bug that Ctrl-C sometimes does not work as expected in Windows Terminal. Addresses: https://cygwin.com/pipermail/cygwin/2021-November/249749.html Diff: --- winsup/cygwin/fhandler_console.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 940c66a6e..0501b36fa 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1178,6 +1178,10 @@ out: /* Discard processed recored. */ DWORD dummy; DWORD discard_len = min (total_read, i + 1); + /* If input is signalled, do not discard input here because + tcflush() is already called from line_edit(). */ + if (stat == input_signalled && !(ti->c_lflag & NOFLSH)) + discard_len = 0; if (discard_len) ReadConsoleInputW (get_handle (), input_rec, discard_len, &dummy); return stat;