From 423022b8bc9a76aecd85a13bf8c3b82f06522441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Fri, 25 Aug 2017 12:26:18 +0200 Subject: [PATCH] Fixed the DECCOLM bug (not clearing screen etc) and a scrolling up not erasing freed lines bug --- user/apars_csi.c | 12 +++++++++--- user/cgi_sockets.c | 12 ++++++++---- user/screen.c | 6 ++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/user/apars_csi.c b/user/apars_csi.c index de0b92b..c1ce4f5 100644 --- a/user/apars_csi.c +++ b/user/apars_csi.c @@ -424,8 +424,14 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts) screen_set_charset(1, 'B'); } else if (n == 3) { - // 132 column mode - not implemented due to RAM demands - ansi_noimpl("80->132"); + // DECCOLM 132 column mode - not implemented due to RAM demands + ansi_noimpl("132col"); + + // DECCOLM side effects as per + // https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/deccolm-cls.html + screen_clear(CLEAR_ALL); + screen_set_scrolling_region(0, 0); + screen_cursor_set(0, 0); } else if (n == 4) { // Smooth scroll - not implemented @@ -463,7 +469,7 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts) else if (n == 40) { // allow/disallow 80->132 mode // not implemented because of RAM demands - ansi_noimpl("80->132 enable"); + ansi_noimpl("132col enable"); } else if (n == 45) { // reverse wrap-around diff --git a/user/cgi_sockets.c b/user/cgi_sockets.c index 6556c0c..889379c 100644 --- a/user/cgi_sockets.c +++ b/user/cgi_sockets.c @@ -8,6 +8,8 @@ #include "uart_buffer.h" #include "ansi_parser.h" +#define LOOPBACK 0 + #define SOCK_BUF_LEN 1024 static char sock_buff[SOCK_BUF_LEN]; @@ -128,11 +130,13 @@ void ICACHE_FLASH_ATTR updateSockRx(Websock *ws, char *data, int len, int flags) if (strstarts(data, "STR:")) { // pass string verbatim +#if LOOPBACK + for(int i=4;i= 0 && from < H-1 && to > from) { @@ -691,6 +692,7 @@ screen_set_scrolling_region(int from, int to) scr.vm1 = to; } else { // Bad range, do nothing + ansi_warn("Bad SR bounds %d, %d", from, to); } // Always move cursor home (may be translated due to DECOM)