Fixed the DECCOLM bug (not clearing screen etc) and a scrolling up not erasing freed lines bug

pull/111/merge
Ondřej Hruška 7 years ago
parent fce3995800
commit 423022b8bc
  1. 12
      user/apars_csi.c
  2. 12
      user/cgi_sockets.c
  3. 6
      user/screen.c

@ -424,8 +424,14 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
screen_set_charset(1, 'B'); screen_set_charset(1, 'B');
} }
else if (n == 3) { else if (n == 3) {
// 132 column mode - not implemented due to RAM demands // DECCOLM 132 column mode - not implemented due to RAM demands
ansi_noimpl("80->132"); 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) { else if (n == 4) {
// Smooth scroll - not implemented // Smooth scroll - not implemented
@ -463,7 +469,7 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
else if (n == 40) { else if (n == 40) {
// allow/disallow 80->132 mode // allow/disallow 80->132 mode
// not implemented because of RAM demands // not implemented because of RAM demands
ansi_noimpl("80->132 enable"); ansi_noimpl("132col enable");
} }
else if (n == 45) { else if (n == 45) {
// reverse wrap-around // reverse wrap-around

@ -8,6 +8,8 @@
#include "uart_buffer.h" #include "uart_buffer.h"
#include "ansi_parser.h" #include "ansi_parser.h"
#define LOOPBACK 0
#define SOCK_BUF_LEN 1024 #define SOCK_BUF_LEN 1024
static char sock_buff[SOCK_BUF_LEN]; 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:")) { if (strstarts(data, "STR:")) {
// pass string verbatim // pass string verbatim
#if LOOPBACK
for(int i=4;i<strlen(data); i++) {
ansi_parser(data[i]);
}
#else
UART_SendAsync(data+4, -1); UART_SendAsync(data+4, -1);
// debug loopback #endif
// for(int i=4;i<strlen(data); i++) {
// ansi_parser(data[i]);
// }
} }
else if (strstarts(data, "BTN:")) { else if (strstarts(data, "BTN:")) {
// send button as low ASCII value 1-9 // send button as low ASCII value 1-9

@ -4,6 +4,7 @@
#include "persist.h" #include "persist.h"
#include "sgr.h" #include "sgr.h"
#include "ascii.h" #include "ascii.h"
#include "apars_logging.h"
TerminalConfigBundle * const termconf = &persist.current.termconf; TerminalConfigBundle * const termconf = &persist.current.termconf;
TerminalConfigBundle termconf_scratch; TerminalConfigBundle termconf_scratch;
@ -646,7 +647,7 @@ screen_scroll_up(unsigned int lines)
memcpy(screen + y * W, screen + (y + lines) * W, W * sizeof(Cell)); memcpy(screen + y * W, screen + (y + lines) * W, W * sizeof(Cell));
} }
clear_range(R0 * W+y * W, (R1+1)*W-1); clear_range(y * W, (R1+1)*W-1);
done: done:
NOTIFY_DONE(); NOTIFY_DONE();
@ -683,7 +684,7 @@ screen_scroll_down(unsigned int lines)
void ICACHE_FLASH_ATTR void ICACHE_FLASH_ATTR
screen_set_scrolling_region(int from, int to) screen_set_scrolling_region(int from, int to)
{ {
if (from == 0 && to == 0) { if (from <= 0 && to <= 0) {
scr.vm0 = 0; scr.vm0 = 0;
scr.vm1 = H-1; scr.vm1 = H-1;
} else if (from >= 0 && from < H-1 && to > from) { } else if (from >= 0 && from < H-1 && to > from) {
@ -691,6 +692,7 @@ screen_set_scrolling_region(int from, int to)
scr.vm1 = to; scr.vm1 = to;
} else { } else {
// Bad range, do nothing // Bad range, do nothing
ansi_warn("Bad SR bounds %d, %d", from, to);
} }
// Always move cursor home (may be translated due to DECOM) // Always move cursor home (may be translated due to DECOM)

Loading…
Cancel
Save