* related fields in it */
void rote_es_interpret_csi(RoteTerm *rt);
+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;
+}
#endif