XenevaOS
Loading...
Searching...
No Matches
XenevaOS
Process
Terminal
term.h
Go to the documentation of this file.
1
30
#ifndef __TERMINAL_H__
31
#define __TERMINAL_H__
32
33
#include <stdint.h>
34
35
#define TERMINAL_MAX_COLS 256
36
#define TERMINAL_MAX_ROWS 128
37
38
#define TERMINAL_HISTORY_MAX 100
39
40
#define TERMINAL_SCROLLBACK_MAX 1000
41
42
/* Cell flag bits. 0x1 marks a cell TerminalFlush should repaint, 0x2 is the
43
* blinking cursor block, and 0x4 is a selected cell. Selection is a flag
44
* rather than swapped colours because new output can land under a live
45
* highlight, and swapping in place would corrupt the cell's real colours. */
46
#define TERMINAL_CELL_SELECTED 0x4
47
48
typedef
struct
_cell_
{
49
uint8_t
c
;
50
uint32_t
bg
;
51
uint32_t
fg
;
52
uint8_t
flags
;
53
}
TermCell
;
54
55
typedef
struct
_term_history_
{
56
char
entries
[
TERMINAL_HISTORY_MAX
][256];
57
int
count
;
58
int
head
;
59
int
browse
;
60
}
TerminalHistory
;
61
62
typedef
struct
{
63
TermCell
cells[
TERMINAL_MAX_ROWS
][
TERMINAL_MAX_COLS
];
64
int
cols
,
rows
;
65
int
cursorX
, cursorY;
66
int
lastCursorX
, lastCursorY;
67
int
inputStartX
, inputStartY;
68
int
savedCursorX
, savedCursorY;
69
int
cellW,
cellH
;
70
int
baseine
;
71
int
originX
, originY;
72
uint32_t
defaultFg
;
73
uint32_t
defaultBG
;
74
int
scrollTop
;
75
int
scrollBot
;
76
TerminalHistory
history
;
77
char
inputBuffer[256];
78
char
inputSaved[256];
79
int
intputLen
;
80
int
lastCellXClicked
;
81
int
lastCellYClicked
;
82
/* Mouse selection. lastCellXClicked/YClicked doubles as the anchor,
83
* selEndX/Y is the corner being dragged to, and selPaintX0..Y1 is the
84
* rectangle currently highlighted so shrinking a selection repaints
85
* only the rows it is leaving. */
86
int
selEndX
;
87
int
selEndY
;
88
bool
selActive
;
89
int
lastButtonState
;
90
int
selPaintX0
;
91
int
selPaintY0
;
92
int
selPaintX1
;
93
int
selPaintY1
;
94
volatile
bool
blink_visible
;
95
bool
scrolling
;
96
bool
cursor_hide
;
97
TermCell
*
sb
;
98
int
sbHead
;
99
int
sbCount
;
100
int
viewOffset
;
101
}
Terminal
;
102
103
#endif
uint32_t
unsigned int uint32_t
Definition
acefiex.h:163
uint8_t
unsigned char uint8_t
Definition
acefiex.h:161
Terminal
Definition
term.h:62
Terminal::cursor_hide
bool cursor_hide
Definition
term.h:96
Terminal::sb
TermCell * sb
Definition
term.h:97
Terminal::selEndX
int selEndX
Definition
term.h:86
Terminal::selPaintY0
int selPaintY0
Definition
term.h:91
Terminal::history
TerminalHistory history
Definition
term.h:76
Terminal::blink_visible
volatile bool blink_visible
Definition
term.h:94
Terminal::lastCursorX
int lastCursorX
Definition
term.h:66
Terminal::selActive
bool selActive
Definition
term.h:88
Terminal::lastButtonState
int lastButtonState
Definition
term.h:89
Terminal::selPaintX1
int selPaintX1
Definition
term.h:92
Terminal::cursorX
int cursorX
Definition
term.h:65
Terminal::cols
int cols
Definition
term.h:64
Terminal::baseine
int baseine
Definition
term.h:70
Terminal::defaultBG
uint32_t defaultBG
Definition
term.h:73
Terminal::lastCellXClicked
int lastCellXClicked
Definition
term.h:80
Terminal::scrollTop
int scrollTop
Definition
term.h:74
Terminal::selPaintY1
int selPaintY1
Definition
term.h:93
Terminal::originX
int originX
Definition
term.h:71
Terminal::viewOffset
int viewOffset
Definition
term.h:100
Terminal::defaultFg
uint32_t defaultFg
Definition
term.h:72
Terminal::cellH
int cellH
Definition
term.h:69
Terminal::sbCount
int sbCount
Definition
term.h:99
Terminal::selEndY
int selEndY
Definition
term.h:87
Terminal::sbHead
int sbHead
Definition
term.h:98
Terminal::selPaintX0
int selPaintX0
Definition
term.h:90
Terminal::savedCursorX
int savedCursorX
Definition
term.h:68
Terminal::inputStartX
int inputStartX
Definition
term.h:67
Terminal::lastCellYClicked
int lastCellYClicked
Definition
term.h:81
Terminal::intputLen
int intputLen
Definition
term.h:79
Terminal::scrolling
bool scrolling
Definition
term.h:95
Terminal::scrollBot
int scrollBot
Definition
term.h:75
_cell_
Definition
term.h:48
_cell_::fg
uint32_t fg
Definition
term.h:51
_cell_::flags
uint8_t flags
Definition
term.h:52
_cell_::c
uint8_t c
Definition
term.h:49
_cell_::bg
uint32_t bg
Definition
term.h:50
_term_history_
Definition
term.h:55
_term_history_::count
int count
Definition
term.h:57
_term_history_::browse
int browse
Definition
term.h:59
_term_history_::entries
char entries[TERMINAL_HISTORY_MAX][256]
Definition
term.h:56
_term_history_::head
int head
Definition
term.h:58
TERMINAL_HISTORY_MAX
#define TERMINAL_HISTORY_MAX
Definition
term.h:38
TERMINAL_MAX_COLS
#define TERMINAL_MAX_COLS
Definition
term.h:35
TerminalHistory
struct _term_history_ TerminalHistory
TermCell
struct _cell_ TermCell
TERMINAL_MAX_ROWS
#define TERMINAL_MAX_ROWS
Definition
term.h:36
rows
__virtio16 rows
Definition
virtio_console.h:3
Generated by
1.9.8