mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-14 04:27:57 -05:00
csi: implement \E[@ (ICH - insert characters)
This commit is contained in:
parent
056700aa8f
commit
20684afa8c
1 changed files with 24 additions and 15 deletions
39
csi.c
39
csi.c
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue