[newlib-cygwin] Cygwin: pty: Omit CSI?1004h/l from pseudo console output
Takashi Yano via Cygwin-cvs <[email protected]> Wed, 25 Mar 2026 21:32:35 +0000 (GMT)
| Newsgroups | gmane.os.cygwin.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1bddcff4cc3d2919343cc762f77eff4c4f278513 commit 1bddcff4cc3d2919343cc762f77eff4c4f278513 Author: Takashi Yano <[email protected]> Date: Mon Mar 9 17:33:12 2026 +0900 Cygwin: pty: Omit CSI?1004h/l from pseudo console output "CSI?1004h" is the sequence that enables focus event report. This can be handle correctly by pseudo console, however, if the pty input is not connected to pseudo console, the focus event responses such as "CSI I/O" are sent to the foreground process. Due to this, `cat` receives these responses unexpectedly in the command below. $ cmd & $ cat This seems to happen since Windows 11. To avoid this, this patch removes "CSI?1004h/l" from pseudo console output. Signed-off-by: Takashi Yano <[email protected]> Reviewed-by: Corinna Vinschen <[email protected]> Diff: --- winsup/cygwin/fhandler/pty.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc index 9868e88e5..9ea9e80ef 100644 --- a/winsup/cygwin/fhandler/pty.cc +++ b/winsup/cygwin/fhandler/pty.cc @@ -2733,7 +2733,8 @@ workarounds_for_pseudo_console_output (char *outbuf, DWORD rlen) } state = 0; } - else if (saw_question_mark && arg == 9001 + else if (saw_question_mark + && (arg == 9001 || arg == 1004) && (outbuf[i] == 'h' || outbuf[i] == 'l')) { memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1);