Commit: 697c5beeccfbfc7fa274f0c31c1c1dd1b067af37
Parent: 3e930e3140300c9bef7fbb94b7dacb7cdcbc2df7
Author: Randy Palamar
Date: Sat, 24 Aug 2024 13:07:18 -0600
ECH: erase characters and ignore couple more set_mode()s
Diffstat:
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/terminal.c b/terminal.c
@@ -353,6 +353,14 @@ erase_in_line(Term *t, CSI *csi)
}
}
+/* ECH: Erase Characters */
+static void
+erase_characters(Term *t, i32 count)
+{
+ iv2 cpos = t->cursor.pos;
+ fb_clear_region(t, cpos.y, cpos.y, cpos.x, cpos.x + count - 1);
+}
+
/* SM/DECSET: Set Mode & RM/DECRST Reset Mode */
static void
set_mode(Term *t, CSI *csi, b32 set)
@@ -362,19 +370,21 @@ set_mode(Term *t, CSI *csi, b32 set)
for (i32 i = 0; i < csi->argc; i++) {
i32 arg = (csi->argv[i]) | ((csi->priv & 1) << 30);
switch (arg) {
- case 4: /* IRM: Insert/Replace Mode */
+ case 4: /* IRM: Insert/Replace Mode */
if (set) t->mode |= TM_REPLACE;
else t->mode &= ~TM_REPLACE;
break;
- case PRIV(1): /* DECCKM: use application cursor keys */
+ case PRIV(1): /* DECCKM: use application cursor keys */
if (set) t->gl.mode |= WIN_MODE_APPCURSOR;
else t->gl.mode &= ~WIN_MODE_APPCURSOR;
break;
- case PRIV(3): /* DECCOLM: 132/80 Column Mode */
- case PRIV(4): /* DECSCLM: Fast/Slow Scroll */
+ case PRIV(3): /* DECCOLM: 132/80 Column Mode */
+ case PRIV(4): /* DECSCLM: Fast/Slow Scroll */
+ case PRIV(12): /* AT&T 610: Start blinking cursor */
+ case PRIV(1015): /* urxvt: (broken) mouse mode */
/* IGNORED */
break;
- case PRIV(25): /* DECTCEM: Show/Hide Cursor */
+ case PRIV(25): /* DECTCEM: Show/Hide Cursor */
if (!set) t->gl.mode |= WIN_MODE_HIDECURSOR;
else t->gl.mode &= ~WIN_MODE_HIDECURSOR;
break;
@@ -636,6 +646,7 @@ handle_csi(Term *t, s8 *raw)
case 'H': cursor_move_to(t, csi.argv[0] - 1, csi.argv[1] - 1); break;
case 'J': erase_in_display(t, &csi); break;
case 'K': erase_in_line(t, &csi); break;
+ case 'X': erase_characters(t, ORONE(csi.argv[0])); break;
case 'a': cursor_step_raw(t, ORONE(csi.argv[0]), 0, 1); break;
case 'd': cursor_move_to(t, csi.argv[0] - 1, p.x); break;
case 'e': cursor_step_raw(t, ORONE(csi.argv[0]), 1, 0); break;