csi: implement \E[@ (ICH - insert characters)

This commit is contained in:
Daniel Eklöf 2019-07-17 11:19:28 +02:00
parent 056700aa8f
commit 20684afa8c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

39
csi.c
View file

@ -498,7 +498,7 @@ csi_dispatch(struct terminal *term, uint8_t final)
}
case 'P': {
/* DCH: Delete character */
/* DCH: Delete character(s) */
/* Number of characters to delete */
int count = min(
@ -511,22 +511,37 @@ csi_dispatch(struct terminal *term, uint8_t final)
memmove(&term->grid->cur_row->cells[term->cursor.col],
&term->grid->cur_row->cells[term->cursor.col + count],
remaining * sizeof(term->grid->cur_row->cells[0]));
#if 0
term_damage_update(term, term->cursor.linear, remaining);
#else
term->grid->cur_row->dirty = true;
#endif
/* Erase the remainder of the line */
term_erase(
term,
&(struct coord){term->cursor.col + remaining, term->cursor.row},
&(struct coord){term->cols - 1, term->cursor.row});
#if 0
break;
}
case '@': {
/* ICH: insert character(s) */
/* Number of characters to insert */
int count = min(
vt_param_get(term, 0, 1), term->cols - term->cursor.col);
/* Characters to move */
int remaining = term->cols - (term->cursor.col + count);
/* Push existing characters */
memmove(&term->grid->cur_row->cells[term->cursor.col + count],
&term->grid->cur_row->cells[term->cursor.col],
remaining * sizeof(term->grid->cur_row->cells[0]));
term->grid->cur_row->dirty = true;
/* Erase (insert space characters) */
term_erase(
term, term->cursor.linear + remaining,
term->cursor.linear + remaining + count);
#endif
term,
&term->cursor,
&(struct coord){term->cursor.col + count - 1, term->cursor.row});
break;
}
@ -547,12 +562,6 @@ csi_dispatch(struct terminal *term, uint8_t final)
term,
&term->cursor,
&(struct coord){term->cursor.col + count - 1, term->cursor.row});
#if 0
memset(&term->grid->cur_line[term->cursor.col],
0, count * sizeof(term->grid->cur_line[0]));
term_damage_erase(term, term->cursor.linear, count);
#endif
break;
}