public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH v2] Cygwin: console: Fix behaviour of "ESC 8" after reset.
@ 2020-03-09  1:38 Takashi Yano
  2020-03-09  8:59 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2020-03-09  1:38 UTC (permalink / raw)
  To: cygwin-patches

- 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 1c376291f..2a239b866 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -2124,6 +2124,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;
@@ -2168,6 +2173,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 */
@@ -3070,6 +3076,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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] Cygwin: console: Fix behaviour of "ESC 8" after reset.
  2020-03-09  1:38 [PATCH v2] Cygwin: console: Fix behaviour of "ESC 8" after reset Takashi Yano
@ 2020-03-09  8:59 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2020-03-09  8:59 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

On Mar  9 10:38, 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(+)
> 
> diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
> index 1c376291f..2a239b866 100644
> --- a/winsup/cygwin/fhandler_console.cc
> +++ b/winsup/cygwin/fhandler_console.cc
> @@ -2124,6 +2124,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;
> @@ -2168,6 +2173,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 */
> @@ -3070,6 +3076,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

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-09  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09  1:38 [PATCH v2] Cygwin: console: Fix behaviour of "ESC 8" after reset Takashi Yano
2020-03-09  8:59 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).