Cygwin: console: Fix IL/DL escape sequence on the last line.

- Currently, escape sequence IL/DL (CSI Ps L, CSI Ps M) does not
  work correctly at the last (bottom end) line. This patch fixes
  the issue.

Addresses:
  https://cygwin.com/pipermail/cygwin/2022-February/250736.html
This commit is contained in:
Takashi Yano 2022-02-03 21:09:44 +09:00
parent e5aca9ced9
commit 96646006a7
1 changed files with 12 additions and 0 deletions

View File

@ -2174,6 +2174,12 @@ fhandler_console::char_command (char c)
cursor_get (&x, &y); cursor_get (&x, &y);
if (y < srTop || y > srBottom) if (y < srTop || y > srBottom)
break; break;
if (y == con.b.srWindow.Bottom)
{
WriteConsoleW (get_output_handle (), L"\033[2K", 4, 0, 0);
wpbuf.empty ();
break;
}
if (y == con.b.srWindow.Top if (y == con.b.srWindow.Top
&& srBottom == con.b.srWindow.Bottom) && srBottom == con.b.srWindow.Bottom)
{ {
@ -2213,6 +2219,12 @@ fhandler_console::char_command (char c)
cursor_get (&x, &y); cursor_get (&x, &y);
if (y < srTop || y > srBottom) if (y < srTop || y > srBottom)
break; break;
if (y == con.b.srWindow.Bottom)
{
WriteConsoleW (get_output_handle (), L"\033[2K", 4, 0, 0);
wpbuf.empty ();
break;
}
__small_swprintf (bufw, L"\033[%d;%dr", __small_swprintf (bufw, L"\033[%d;%dr",
y + 1 - con.b.srWindow.Top, y + 1 - con.b.srWindow.Top,
srBottom + 1 - con.b.srWindow.Top); srBottom + 1 - con.b.srWindow.Top);