-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvterm_erase.c
More file actions
115 lines (86 loc) · 2.35 KB
/
vterm_erase.c
File metadata and controls
115 lines (86 loc) · 2.35 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
LICENSE INFORMATION:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation.
Please refer to the COPYING file for more information.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (c) 2009 Bryan Christ
*/
#include "vterm.h"
#include "vterm_colors.h"
#include "vterm_private.h"
#include "vterm_render.h"
#include <stdio.h>
void vterm_erase(vterm_t *vterm)
{
int cell_count;
int x,y;
int i;
if(vterm == NULL) return;
//fprintf(stderr, "vterm_erase\n");
cell_count=vterm->rows*vterm->cols;
for(i=0;i < cell_count;i++)
{
x=i%vterm->cols;
y=(int)(i/vterm->cols);
vterm->cells[y][x].ch=0x20;
vterm->cells[y][x].attr=A_NORMAL;
vterm->cells[y][x].color = (default_fg|default_bg << 4);
}
return;
}
void vterm_erase_row(vterm_t *vterm,gint row)
{
gint i;
if(vterm == NULL) return;
if(row == -1) row=vterm->crow;
for(i=0;i < vterm->cols;i++)
{
vterm->cells[row][i].ch=0x20;
vterm->cells[row][i].attr=A_NORMAL;
vterm->cells[row][i].color = (default_fg|default_bg << 4);
}
return;
}
void vterm_erase_rows(vterm_t *vterm,gint start_row)
{
if(vterm == NULL) return;
if(start_row < 0) return;
while(start_row < vterm->rows)
{
vterm_erase_row(vterm,start_row);
start_row++;
}
return;
}
void vterm_erase_col(vterm_t *vterm,gint col)
{
gint i;
if(vterm==NULL) return;
if(col==-1) col=vterm->ccol;
for(i=0;i < vterm->rows;i++)
{
vterm->cells[i][col].ch=0x20;
vterm->cells[i][col].attr=A_NORMAL;
vterm->cells[i][col].color = (default_fg|default_bg << 4);
}
return;
}
void vterm_erase_cols(vterm_t *vterm,gint start_col)
{
if(vterm == NULL) return;
if(start_col < 0) return;
while(start_col < vterm->cols)
{
vterm_erase_col(vterm,start_col);
start_col++;
}
return;
}