-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvterm_csi_DL.c
50 lines (40 loc) · 1.17 KB
/
vterm_csi_DL.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <string.h>
#include "vterm.h"
#include "vterm_private.h"
#include "vterm_csi.h"
#include "vterm_buffer.h"
/* Interpret a 'delete line' sequence (DL) */
void
interpret_csi_DL(vterm_t *vterm, int param[], int pcount)
{
vterm_cell_t *vcell;
vterm_desc_t *v_desc = NULL;
int c, r;
int n = 1;
int idx;
// set selector for buffer description
idx = vterm_buffer_get_active(vterm);
v_desc = &vterm->vterm_desc[idx];
if(pcount && param[0] > 0) n = param[0];
for(r = v_desc->crow; r <= v_desc->scroll_max; r++)
{
vcell = &v_desc->cells[r][0];
if(r + n <= v_desc->scroll_max)
{
memcpy(v_desc->cells[r], v_desc->cells[r + n],
sizeof(vterm_cell_t) * v_desc->cols);
VCELL_ROW_SET_DIRTY(v_desc->cells[r], v_desc->cols);
}
else
{
for(c = 0; c < v_desc->cols; c++)
{
VCELL_SET_CHAR((*vcell), ' ');
VCELL_SET_ATTR((*vcell), v_desc->curattr);
VCELL_SET_COLORS((*vcell), v_desc);
vcell++;
}
}
}
return;
}