-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
187 lines (154 loc) · 5.21 KB
/
types.go
File metadata and controls
187 lines (154 loc) · 5.21 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
package xterm
// Ported from xterm.js src/common/Types.ts and src/common/buffer/Types.ts.
// CharData is the legacy cell representation: [attr, char, width, code].
type CharData [4]interface{}
// CharDataAttr returns the attribute (fg) from CharData.
func CharDataAttr(cd CharData) uint32 { return cd[charDataAttrIndex].(uint32) }
// CharDataChar returns the character string from CharData.
func CharDataChar(cd CharData) string { return cd[charDataCharIndex].(string) }
// CharDataWidth returns the display width from CharData.
func CharDataWidth(cd CharData) int { return cd[charDataWidthIndex].(int) }
// CharDataCode returns the codepoint from CharData.
func CharDataCode(cd CharData) uint32 { return cd[charDataCodeIndex].(uint32) }
// NewCharData creates a CharData tuple.
func NewCharData(attr uint32, ch string, width int, code uint32) CharData {
return CharData{attr, ch, width, code}
}
// Charset maps single-byte characters to replacement strings (e.g., DEC special graphics).
type Charset map[byte]rune
// ColorRGB is an [R, G, B] color triple, each component 0-255.
type ColorRGB [3]uint8
// Color represents a color with a CSS string and a 32-bit RGBA value.
type Color struct {
CSS string
RGBA uint32
}
// Modes tracks standard ANSI modes.
type Modes struct {
InsertMode bool
}
// CursorStyle is the shape of the cursor.
type CursorStyle string
const (
CursorStyleBlock CursorStyle = "block"
CursorStyleUnderline CursorStyle = "underline"
CursorStyleBar CursorStyle = "bar"
)
// CursorInactiveStyle is the shape of the cursor when the terminal is not focused.
type CursorInactiveStyle string
const (
CursorInactiveStyleOutline CursorInactiveStyle = "outline"
CursorInactiveStyleBlock CursorInactiveStyle = "block"
CursorInactiveStyleBar CursorInactiveStyle = "bar"
CursorInactiveStyleUnderline CursorInactiveStyle = "underline"
CursorInactiveStyleNone CursorInactiveStyle = "none"
)
// DecPrivateModes tracks DEC private mode settings.
type DecPrivateModes struct {
ApplicationCursorKeys bool
ApplicationKeypad bool
BracketedPasteMode bool
ColorSchemeUpdates bool
CursorBlink *bool // nil = not set by DECSET/DECRST
CursorBlinkOverride *bool // nil = not set by DECSCUSR
CursorStyle *CursorStyle // nil = not set
MouseEncoding string // "DEFAULT", "SGR", "SGR_PIXELS"
MouseTrackingMode string // "NONE", "X10", "VT200", "DRAG", "ANY"
Origin bool
ReverseWraparound bool
SendFocus bool
SynchronizedOutput bool
Win32InputMode bool
Wraparound bool
}
// CoreMouseButton identifies a mouse button.
type CoreMouseButton int
const (
MouseButtonLeft CoreMouseButton = 0
MouseButtonMiddle CoreMouseButton = 1
MouseButtonRight CoreMouseButton = 2
MouseButtonNone CoreMouseButton = 3
MouseButtonWheel CoreMouseButton = 4
MouseButtonAux1 CoreMouseButton = 8
MouseButtonAux2 CoreMouseButton = 9
MouseButtonAux3 CoreMouseButton = 10
MouseButtonAux4 CoreMouseButton = 11
MouseButtonAux5 CoreMouseButton = 12
MouseButtonAux6 CoreMouseButton = 13
MouseButtonAux7 CoreMouseButton = 14
MouseButtonAux8 CoreMouseButton = 15
)
// CoreMouseAction identifies a mouse action.
type CoreMouseAction int
const (
MouseActionUp CoreMouseAction = 0
MouseActionDown CoreMouseAction = 1
MouseActionLeft CoreMouseAction = 2
MouseActionRight CoreMouseAction = 3
MouseActionMove CoreMouseAction = 32
)
// CoreMouseEvent represents a mouse event in the terminal core.
type CoreMouseEvent struct {
Col int
Row int
X int
Y int
Button CoreMouseButton
Action CoreMouseAction
Ctrl bool
Alt bool
Shift bool
}
// CoreMouseEventType is a bitmask of mouse event categories a protocol wants to receive.
type CoreMouseEventType int
const (
MouseEventNone CoreMouseEventType = 0
MouseEventDown CoreMouseEventType = 1
MouseEventUp CoreMouseEventType = 2
MouseEventDrag CoreMouseEventType = 4
MouseEventMove CoreMouseEventType = 8
MouseEventWheel CoreMouseEventType = 16
)
// ColorRequestType identifies the kind of color request (OSC 4/10/11/12).
type ColorRequestType int
const (
ColorRequestReport ColorRequestType = 0
ColorRequestSet ColorRequestType = 1
ColorRequestRestore ColorRequestType = 2
)
// SpecialColorIndex identifies special color slots beyond the 256-color palette.
type SpecialColorIndex int
const (
SpecialColorForeground SpecialColorIndex = 256
SpecialColorBackground SpecialColorIndex = 257
SpecialColorCursor SpecialColorIndex = 258
)
// ScrollEvent carries a scroll position.
type ScrollEvent struct {
Position int
}
// RowRange represents a range of rows [Start, End).
type RowRange struct {
Start int
End int
}
// InsertEvent is fired when items are inserted into a CircularList.
type InsertEvent struct {
Index int
Amount int
}
// DeleteEvent is fired when items are deleted from a CircularList.
type DeleteEvent struct {
Index int
Amount int
}
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex].
type BufferIndex [2]int
// KittyKeyboardState tracks the kitty keyboard protocol state.
type KittyKeyboardState struct {
Flags int
MainFlags int
AltFlags int
MainStack []int
AltStack []int
}