#include "roteprivate.h"
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#define MAX_CSI_ES_PARAMS 32
-static inline void clamp_cursor_to_bounds(RoteTerm *rt) {
- if (rt->crow < 0) rt->curpos_dirty = true, rt->crow = 0;
- if (rt->ccol < 0) rt->curpos_dirty = true, rt->ccol = 0;
-
- if (rt->crow >= rt->rows)
- rt->curpos_dirty = true, rt->crow = rt->rows - 1;
-
- if (rt->ccol >= rt->cols)
- rt->curpos_dirty = true, rt->ccol = rt->cols - 1;
-}
-
/* interprets a 'set attribute' (SGR) CSI escape sequence */
static void interpret_csi_SGR(RoteTerm *rt, int param[], int pcount) {
int i;
/* delegate handling depending on command character (verb) */
switch (verb) {
+ case 'h':
+ if (param_count == 1 && csiparam[0] == 4) /* insert mode */
+ rt->insert = true;
+ break;
+ case 'l':
+ if (param_count == 1 && csiparam[0] == 4) /* replace mode */
+ rt->insert = false;
+ break;
case 'm': /* it's a 'set attribute' sequence */
interpret_csi_SGR(rt, csiparam, param_count); break;
case 'J': /* it's an 'erase display' sequence */
interpret_csi_SAVECUR(rt, csiparam, param_count); break;
case 'u': /* restore cursor location */
interpret_csi_RESTORECUR(rt, csiparam, param_count); break;
- #ifdef DEBUG
default:
- fprintf(stderr, "Unrecogized CSI: <%s>\n", rt->pd->esbuf); break;
- #endif
+ #ifdef DEBUG
+ fprintf(stderr, "Unrecogized CSI: verb=%c <%s>\n",
+ verb, rt->pd->esbuf);
+ #endif
+ break;
}
}