Cygwin: console: Add workaround for broken CSI3J in Win10 1809.

- In Win10 1809, the cursor position sometimes goes out of screen
  by clear command in console. This seems to be caused by escape
  sequence CSI3J (ESC[3J). This happens only for 1809. This patch
  is a workaround for the issue.
This commit is contained in:
Takashi Yano
2020-01-14 10:53:59 +09:00
committed by Corinna Vinschen
parent d7478090d6
commit f03806b68a
3 changed files with 54 additions and 1 deletions

View File

@ -1658,6 +1658,18 @@ bool fhandler_console::write_console (PWCHAR buf, DWORD len, DWORD& done)
if (wincap.has_con_24bit_colors () && !con_is_legacy
&& memmem (buf, len*sizeof (WCHAR), L"\033[?1049", 7*sizeof (WCHAR)))
need_fix_tab_position = true;
/* Workaround for broken CSI3J (ESC[3J) support in xterm compatible mode. */
if (wincap.has_con_24bit_colors () && !con_is_legacy &&
wincap.has_con_broken_csi3j ())
{
WCHAR *p = buf;
while ((p = (WCHAR *) memmem (p, (len - (p - buf))*sizeof (WCHAR),
L"\033[3J", 4*sizeof (WCHAR))))
{
memmove (p, p+4, (len - (p+4 - buf))*sizeof (WCHAR));
len -= 4;
}
}
if (con.iso_2022_G1
? con.vt100_graphics_mode_G1