From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id DF3C53858418; Thu, 3 Feb 2022 12:20:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF3C53858418 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: console: Fix IL/DL escape sequence on the last line. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: e5aca9ced94c1e42390f1d0a2fd7eb2ae09bd5a3 X-Git-Newrev: 96646006a7d9a4376255a25a2cbaad8502751c2a Message-Id: <20220203122042.DF3C53858418@sourceware.org> Date: Thu, 3 Feb 2022 12:20:42 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2022 12:20:43 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D96646006a7d= 9a4376255a25a2cbaad8502751c2a commit 96646006a7d9a4376255a25a2cbaad8502751c2a Author: Takashi Yano Date: Thu Feb 3 21:09:44 2022 +0900 Cygwin: console: Fix IL/DL escape sequence on the last line. =20 - 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. =20 Addresses: https://cygwin.com/pipermail/cygwin/2022-February/250736.html Diff: --- winsup/cygwin/fhandler_console.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_con= sole.cc index 0e4b41559..fa5d7ce9c 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -2174,6 +2174,12 @@ fhandler_console::char_command (char c) cursor_get (&x, &y); if (y < srTop || y > srBottom) break; + if (y =3D=3D con.b.srWindow.Bottom) + { + WriteConsoleW (get_output_handle (), L"\033[2K", 4, 0, 0); + wpbuf.empty (); + break; + } if (y =3D=3D con.b.srWindow.Top && srBottom =3D=3D con.b.srWindow.Bottom) { @@ -2213,6 +2219,12 @@ fhandler_console::char_command (char c) cursor_get (&x, &y); if (y < srTop || y > srBottom) break; + if (y =3D=3D con.b.srWindow.Bottom) + { + WriteConsoleW (get_output_handle (), L"\033[2K", 4, 0, 0); + wpbuf.empty (); + break; + } __small_swprintf (bufw, L"\033[%d;%dr", y + 1 - con.b.srWindow.Top, srBottom + 1 - con.b.srWindow.Top);