-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvterm.hpp
More file actions
83 lines (61 loc) · 1.68 KB
/
vterm.hpp
File metadata and controls
83 lines (61 loc) · 1.68 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
#pragma once
#include "graphics.hpp"
namespace app {
class VTerm {
protected:
// row and column indexes are 0 based.
int row{0};
int col{0};
// scroll end is one past the end row.
int scroll_row_begin{0};
int scroll_row_end{24};
int rows{24};
int cols{80};
public:
gfx::TermWin window;
gfx::TermCell cell;
gfx::TermCell reset;
VTerm(int rows, int cols);
void resize(int rows, int cols, int pointSize);
void resize(int rows, int cols);
void overwriteglyph(const char *input, size_t len);
void putglyph(const char *input, size_t len);
void curs_newline();
void curs_backspace();
void curs_to_col(int col);
void curs_to_row(int row);
void cell_set_(gfx::TermCell::Attr attr);
void cell_reset_(gfx::TermCell::Attr attr);
template <typename... As> void cell_set(As... as) {
auto f = [this](auto arg) {
cell_set_(arg);
return true;
};
bool X[] = {(f(as))...};
(void)X;
}
template <typename... As> void cell_reset(As... as) {
auto f = [this](auto arg) {
cell_reset_(arg);
return true;
};
bool X[] = {f(as)...};
(void)X;
}
void cell_set_fg(uint32_t);
void cell_set_bg(uint32_t);
// Set the color of the cell
void scroll_up(int num=1);
// Scroll the region up, num times
void scroll_down(int num=1);
// Scroll the region down, num times
void insert_lines(int num=1);
// Insert num lines. scrolls down
void delete_lines(int num=1);
// Delete num lines. scrolls up
void start_new_row();
// Called after row has been updated. may scroll the screen.
void move_rows(int top_row, int bottom_row, int rows_up);
// Move the given set of rows up or down.
};
} // namespace app