public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Discard CSI > Pm m sequence from native windows apps. Date: Wed, 1 Jul 2020 07:27:22 +0000 (GMT) [thread overview] Message-ID: <20200701072722.11CD23857007@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8121b606e843c001d5ca5213d24099e04ebc62ca commit 8121b606e843c001d5ca5213d24099e04ebc62ca Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> Date: Tue Jun 30 20:12:13 2020 +0900 Cygwin: pty: Discard CSI > Pm m sequence from native windows apps. - If vim is started from WSL (Ubuntu) which is executed in pseudo console in mintty, shift key and ctrl key do not work. Though this issue is similar to the issue resolved by commit 4527541ec66af8d82bb9dba5d25afdf489d71271, that commit is not effective for this issue. This patch fixes the issue by discarding "CSI > Pm m" in fhandler_pty_master::pty_master_fwd_thread(). Diff: --- winsup/cygwin/fhandler_tty.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 126249d9f..0f95cec2e 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -3316,6 +3316,34 @@ fhandler_pty_master::pty_master_fwd_thread () continue; } + /* Remove CSI > Pm m */ + state = 0; + start_at = 0; + for (DWORD i=0; i<rlen; i++) + if (outbuf[i] == '\033') + { + start_at = i; + state = 1; + continue; + } + else if ((state == 1 && outbuf[i] == '[') || + (state == 2 && outbuf[i] == '>')) + { + state ++; + continue; + } + else if (state == 3 && (isdigit (outbuf[i]) || outbuf[i] == ';')) + continue; + else if (state == 3 && outbuf[i] == 'm') + { + memmove (&outbuf[start_at], &outbuf[i+1], rlen-i-1); + rlen = wlen = start_at + rlen - i - 1; + state = 0; + continue; + } + else + state = 0; + size_t nlen; char *buf = convert_mb_str (get_ttyp ()->term_code_page, &nlen, CP_UTF8, ptr, wlen);
reply other threads:[~2020-07-01 7:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200701072722.11CD23857007@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).