[PATCH] Cygwin: console: Fix behaviour of "ESC 8" after reset.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Cygwin: console: Fix behaviour of "ESC 8" after reset.

Takashi Yano
- This patch matches the behaviour of "ESC 8" (DECRC) to the real
  xterm after full reset (RIS), soft reset (DECSTR) and "CSI 3 J".
---
 winsup/cygwin/fhandler_console.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index c5f269168..72ccf7910 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -2114,6 +2114,11 @@ fhandler_console::char_command (char c)
   break;
  case 'J': /* ED */
   wpbuf_put (c);
+  if (con.args[0] == 3 && con.savey >= 0)
+    {
+      con.fillin (get_output_handle ());
+      con.savey -= con.b.srWindow.Top;
+    }
   if (con.args[0] == 3 && wincap.has_con_broken_csi3j ())
     { /* Workaround for broken CSI3J in Win10 1809 */
       CONSOLE_SCREEN_BUFFER_INFO sbi;
@@ -2158,6 +2163,7 @@ fhandler_console::char_command (char c)
     {
       con.scroll_region.Top = 0;
       con.scroll_region.Bottom = -1;
+      con.savex = con.savey = -1;
     }
   wpbuf_put (c);
   /* Just send the sequence */
@@ -3063,6 +3069,7 @@ fhandler_console::write (const void *vsrc, size_t len)
  {
   con.scroll_region.Top = 0;
   con.scroll_region.Bottom = -1;
+  con.savex = con.savey = -1;
  }
       /* ESC sequences below (e.g. OSC, etc) are left to xterm
  emulation in xterm compatible mode, therefore, are not
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Cygwin: console: Fix behaviour of "ESC 8" after reset.

Takashi Yano
On Fri,  6 Mar 2020 10:55:28 +0900
Takashi Yano wrote:
> - This patch matches the behaviour of "ESC 8" (DECRC) to the real
>   xterm after full reset (RIS), soft reset (DECSTR) and "CSI 3 J".
> ---
>  winsup/cygwin/fhandler_console.cc | 7 +++++++
>  1 file changed, 7 insertions(+)

If this patch is applied first, Hans's patch cannot be
applied cleanly. So, I will submit v2 patch which can
be applied after Hans's patch.

--
Takashi Yano <[hidden email]>