diff options
author | Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> | 2020-06-30 20:12:13 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-07-01 09:25:54 +0200 |
commit | 8121b606e843c001d5ca5213d24099e04ebc62ca (patch) | |
tree | afbf495298cd04c0b6b2930b448cfacfe5add6be | |
parent | a97bdf100f54c736c1ab46d39984c4deaacd7386 (diff) | |
download | cygnal-8121b606e843c001d5ca5213d24099e04ebc62ca.tar.gz cygnal-8121b606e843c001d5ca5213d24099e04ebc62ca.tar.bz2 cygnal-8121b606e843c001d5ca5213d24099e04ebc62ca.zip |
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().
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 28 |
1 files changed, 28 insertions, 0 deletions
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); |