From 634704b6def9dbea7eb9a383094e84e3dd6dbc56 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 11 Jul 2019 21:13:43 +0000 Subject: [PATCH] Add shift-left and shift-right which are sort of horizontal scroll, but they don't move the cursor position. --- src/conio/cterm.c | 44 +++++++++++++++++++++++++++++++++++++++++++- src/conio/cterm.txt | 18 ++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/conio/cterm.c b/src/conio/cterm.c index e110de307a..024ac00819 100644 --- a/src/conio/cterm.c +++ b/src/conio/cterm.c @@ -2156,8 +2156,50 @@ static void do_ansi(struct cterminal *cterm, char *retbuf, size_t retsize, int * break; } else if (seq->ctrl_func[1]) { // Control Function with Intermediate Character + // Shift left TODO: Does this interact with scrolling regions? + if (strcmp(seq->ctrl_func, " @") == 0) { + seq_default(seq, 0, 1); + i = seq->param_int[0]; + if(i > cterm->width) + i = cterm->width; + MOVETEXT(cterm->x + i, cterm->y, cterm->x + cterm->width - 1, cterm->y + cterm->height - 1, cterm->x, cterm->y); + j = i * cterm->height; + vc = malloc(j * sizeof(*vc)); + if (vc != NULL) { + for(k=0; k < j; k++) { + vc[k].ch=' '; + vc[k].legacy_attr=cterm->attr; + vc[k].fg=cterm->fg_color; + vc[k].bg=cterm->bg_color; + vc[k].font = ciolib_attrfont(cterm->attr); + } + vmem_puttext(cterm->x + cterm->width - i, cterm->y, cterm->x + cterm->width - 1, cterm->y + cterm->height - 1, vc); + free(vc); + } + } + // Shift right TODO: Does this interact with scrolling regions? + else if (strcmp(seq->ctrl_func, " A") == 0) { + seq_default(seq, 0, 1); + i = seq->param_int[0]; + if(i > cterm->width) + i = cterm->width; + MOVETEXT(cterm->x, cterm->y, cterm->x + cterm->width - 1 - i, cterm->y + cterm->height - 1, cterm->x + i, cterm->y); + j = i * cterm->height; + vc = malloc(j * sizeof(*vc)); + if (vc != NULL) { + for(k=0; k < j; k++) { + vc[k].ch=' '; + vc[k].legacy_attr=cterm->attr; + vc[k].fg=cterm->fg_color; + vc[k].bg=cterm->bg_color; + vc[k].font = ciolib_attrfont(cterm->attr); + } + vmem_puttext(cterm->x, cterm->y, cterm->x + i - 1, cterm->y + cterm->height - 1, vc); + free(vc); + } + } // Font Select - if (strcmp(seq->ctrl_func, " D") == 0) { + else if (strcmp(seq->ctrl_func, " D") == 0) { seq_default(seq, 0, 0); seq_default(seq, 1, 0); switch(seq->param_int[0]) { diff --git a/src/conio/cterm.txt b/src/conio/cterm.txt index e6c50ef369..e363e14033 100644 --- a/src/conio/cterm.txt +++ b/src/conio/cterm.txt @@ -241,6 +241,15 @@ CSI Pn @ SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf +CSI Pn SP @ + Shift Left + Defaults: Pn = 1 + Shifts the contents of the screen left Pn columns(s) with + leftmost columns going off-screen and the resulting hole being + filled with the current attribute. + + SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf + CSI Pn A Cursor Up Defaults: Pn = 1 @@ -250,6 +259,15 @@ CSI Pn A SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf +CSI Pn SP A + Shift Right + Defaults: Pn = 1 + Shifts the contents of the screen right Pn columns(s) with + rightmost columns going off-screen and the resulting hole being + filled with the current attribute. + + SOURCE: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf + CSI Pn B Cursor Down Defaults: Pn = 1 -- GitLab