cygwin used to suppress DECRST 1049

Takashi Yano takashi.yano@nifty.ne.jp
Thu Oct 29 04:11:47 GMT 2026


Hi Thomas,

On Tue, 27 Oct 2026 11:44:00 +0100
Thomas Wolff wrote:
> Hi,
> see https://github.com/mintty/mintty/issues/1387#issuecomment-6140581954
> In cygwin 3.6, apparently, while a native Windows application is 
> running, the control sequence `CSI ? 1049 l` is filtered out, with some 
> functional consequences as described in that issue. Interesting, this 
> does not apply to the corresponding DECSET sequence `CSI ? 1049 h` or to 
> similar sequences with private modes 1047 or 47.

cygwin1.dll does not filter `CSI ? 1049 l` out, but ConPTY does.
ConPTY drains it and handles it by itself internally. Please try
tput smcup > smcup
tput rmcup > rmcup
cmd
type smcup
echo doing something
type rmcup

> This issue does not occur in current 3.7, so it appears to be fixed but 
> I don't see any corresponding note in the git log, so I'd still raise 
> this issue in order to make sure the fix is permanent. I see some 
> special handling of 1049 and also of 9001 in fhandler/console.cc but it 
> does not seem to have changed recently.

If you do not encounter this in cygwin 3.7, perhaps you have OpenConsole.exe
in /usr/bin. OpenConsole.exe does not drain that sequence and passes it
through to the terminal.

> Also, in logs (mintty -l log) of the test case
>      tput smcup
>      echo doing something
>      tput rmcup > rmcup
>      cmd /C type rmcup
> I see the Windows conhost termination control DECRST 9001 but not the 
> initial DECSET 9001. If it were present, it could possibly be used for 
> some terminal adjustment for native Windows applications or even as a 
> workaround for the above issue.

cygwin1.dll removes CSI ? 9001 h/l from ouptput since the commit:

commit b7541ef1242ac2e5d46fb1ac8704024f99042c47
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Thu Feb 19 17:13:55 2026 +0900

    Cygwin: pty: Omit win32-input-mode sequence from pseudo console

    In Windows 11, pseudo console uses CSI?9001h which lets the terminal
    enter win32-input-mode in console. As a result, two problems happen.

    1) If non-cygwin app is running in script command on the console,
       Ctrl-C terminates not only the non-cygwin app, but also script
       command without cleanup for the pseudo console.

    2) Some remnants sequences from win32-input-mode occasionally
       appears on the shell in script command on the console.

    This patch fixes them by omit CSI?9001h to prevent the terminal
    from entering win32-input-mode.

    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
    Suggested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>


-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Cygwin-developers mailing list