[PATCH] Cygwin: pty: Omit CSI?1004h/l from pseudo console output
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Mar 25 19:22:15 GMT 2026
On Mar 25 20:12, Corinna Vinschen wrote:
> Hi Takashi,
>
> On Mar 9 18:24, Takashi Yano wrote:
> > "CSI?1004h" is the sequence that enabes focus event report. This
> enables
>
> > can be handle correctly by pseudo console, however, if the pty
> > input is not connected to pseudo console, the focus event responces
> responses
>
> > such as "CSI I/O" are sent to the foreground process. Due to this,
> > `cat` receives these responces unexpectedly in the command below.
> responses
> >
> > $ cmd &
> > $ cat
> >
> > This seems to happen after Windows 11.
>
> Not sure what this means. What is after W11? Do you mean it happens
> since W11 already?
>
> >
> > To avoid this, this patch removes "CSI?1004h/l" from pseudo console
> > output.
> >
> > Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
> > Reviewed-by:
> > ---
> > 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 0717c043b..65b10dd62 100644
> > --- a/winsup/cygwin/fhandler/pty.cc
> > +++ b/winsup/cygwin/fhandler/pty.cc
> > @@ -2760,7 +2760,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);
> > --
> > 2.51.0
Other than the above commit message stuff, LGTM.
Corinna
More information about the Cygwin-patches
mailing list