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
  4527541ec6, 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().
This commit is contained in:
Takashi Yano via Cygwin-patches 2020-06-30 20:12:13 +09:00 committed by Corinna Vinschen
parent a97bdf100f
commit 8121b606e8
1 changed files with 28 additions and 0 deletions

View File

@ -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);