aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyesc.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-12-20 22:43:37 +0100
committerBoris Faure <billiob@gmail.com>2016-12-20 22:43:37 +0100
commit99f55b7bbc4d375d3b4525e449001dad6e536cdd (patch)
tree89efa6f0c927678275a327a2a73fc61a1f5f87ad /src/bin/termptyesc.c
parenttermio: fix getting selection of known link. CID1367486 (diff)
downloadterminology-99f55b7bbc4d375d3b4525e449001dad6e536cdd.tar.gz
termptyesc: support DECSED3 to erase the backlog. Closes https://phab.enlightenment.org/T3713
Diffstat (limited to 'src/bin/termptyesc.c')
-rw-r--r--src/bin/termptyesc.c58
1 files changed, 42 insertions, 16 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 774bc79..7cb1357 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -980,30 +980,56 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
termpty_write(ty, bf, strlen(bf));
}
break;
- case 'J': // "2j" erases the screen, 1j erase from screen start to curs, 0j erase cursor to end of screen
- DBG("2j erases the screen, 1j erase from screen start to curs, 0j erase cursor to end of screen");
- arg = _csi_arg_get(&b);
- if (b)
+ case 'J':
+ if (*b == '?')
{
- if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL))
- termpty_clear_screen(ty, arg);
- else
- WRN("invalid clr scr %i", arg);
+ b++;
+ arg = _csi_arg_get(&b);
+ WRN("Unsupported selected erase in display %d", arg);
}
else
- termpty_clear_screen(ty, TERMPTY_CLR_END);
+ arg = _csi_arg_get(&b);
+ if (arg < 1) arg = 0;
+ /* 3J erases the backlog,
+ * 2J erases the screen,
+ * 1J erase from screen start to cursor,
+ * 0J erase form cursor to end of screen
+ */
+ DBG("ED/DECSED %d: erase in display", arg);
+ switch (arg)
+ {
+ case TERMPTY_CLR_END:
+ case TERMPTY_CLR_BEGIN:
+ case TERMPTY_CLR_ALL:
+ termpty_clear_screen(ty, arg);
+ break;
+ case 3:
+ termpty_clear_backlog(ty);
+ break;
+ default:
+ ERR("invalid EL/DECSEL argument %d", arg);
+ }
break;
case 'K': // 0K erase to end of line, 1K erase from screen start to cursor, 2K erase all of line
+ if (*b == '?')
+ {
+ b++;
+ arg = _csi_arg_get(&b);
+ WRN("Unsupported selected erase in line %d", arg);
+ }
arg = _csi_arg_get(&b);
- DBG("0K erase to end of line, 1K erase from screen start to cursor, 2K erase all of line: %d", arg);
- if (b)
+ if (arg < 1) arg = 0;
+ DBG("EL/DECSEL %d: erase in line", arg);
+ switch (arg)
{
- if ((arg >= TERMPTY_CLR_END) && (arg <= TERMPTY_CLR_ALL))
- termpty_clear_line(ty, arg, ty->w);
- else
- WRN("invalid clr lin %i", arg);
+ case TERMPTY_CLR_END:
+ case TERMPTY_CLR_BEGIN:
+ case TERMPTY_CLR_ALL:
+ termpty_clear_line(ty, arg, ty->w);
+ break;
+ default:
+ ERR("invalid EL/DECSEL argument %d", arg);
}
- else termpty_clear_line(ty, TERMPTY_CLR_END, ty->w);
break;
case 'h':
case 'l':