27 {std::string({8}), std::string({127})},
58 {
"\x1B[[A",
"\x1BOP"},
59 {
"\x1B[[B",
"\x1BOQ"},
60 {
"\x1B[[C",
"\x1BOR"},
61 {
"\x1B[[D",
"\x1BOS"},
62 {
"\x1B[[E",
"\x1B[15~"},
65 {
"\x1B[11~",
"\x1BOP"},
66 {
"\x1B[12~",
"\x1BOQ"},
67 {
"\x1B[13~",
"\x1BOR"},
68 {
"\x1B[14~",
"\x1BOS"},
71 {
"\x1BOt",
"\x1B[15~"},
72 {
"\x1BOu",
"\x1B[17~"},
73 {
"\x1BOv",
"\x1B[18~"},
74 {
"\x1BOl",
"\x1B[19~"},
75 {
"\x1BOw",
"\x1B[20~"},
76 {
"\x1BOx",
"\x1B[21~"},
83 {
"\x1B[Q",
"\x1B[15~"},
84 {
"\x1B[R",
"\x1B[17~"},
85 {
"\x1B[S",
"\x1B[18~"},
86 {
"\x1B[T",
"\x1B[19~"},
87 {
"\x1B[U",
"\x1B[20~"},
88 {
"\x1B[V",
"\x1B[21~"},
89 {
"\x1B[W",
"\x1B[23~"},
90 {
"\x1B[X",
"\x1B[24~"},
103 if (!pending_.empty()) {
115unsigned char TerminalInputParser::Current() {
116 return pending_[position_];
119bool TerminalInputParser::Eat() {
124void TerminalInputParser::Send(TerminalInputParser::Output
output) {
134 out_->Send(Event::Character(std::move(pending_)));
141 pending_ =
it->second;
149 out_->Send(Event::Mouse(std::move(pending_),
output.mouse));
153 case CURSOR_REPORTING:
154 out_->Send(Event::CursorReporting(std::move(pending_),
163TerminalInputParser::Output TerminalInputParser::Parse() {
179 if (Current() < 32) {
183 if (Current() == 127) {
206TerminalInputParser::Output TerminalInputParser::ParseUTF8() {
207 auto head = Current();
208 unsigned char selector = 0b1000'0000;
215 for (
unsigned int i = 0;
i < 8; ++
i) {
241 if ((
head & 0b1100'0000) != 0b1000'0000) {
245 value +=
head & 0b0011'1111;
250 if (value <= 0b000'0000'0111'1111) {
252 }
else if (value <= 0b000'0111'1111'1111) {
254 }
else if (value <= 0b1111'1111'1111'1111) {
256 }
else if (value <= 0b1'0000'1111'1111'1111'1111) {
269TerminalInputParser::Output TerminalInputParser::ParseESC() {
289TerminalInputParser::Output TerminalInputParser::ParseDCS() {
296 if (Current() !=
'\x1B') {
304 if (Current() !=
'\\') {
312TerminalInputParser::Output TerminalInputParser::ParseCSI() {
321 if (Current() ==
'<') {
326 if (Current() >=
'0' && Current() <=
'9') {
332 if (Current() ==
';') {
340 if (Current() >=
'@' && Current() <=
'~' &&
354 return ParseCursorReporting(std::move(
arguments));
361 if (Current() ==
'\x1B') {
367TerminalInputParser::Output TerminalInputParser::ParseOSC() {
373 if (Current() !=
'\x1B') {
379 if (Current() !=
'\\') {
386TerminalInputParser::Output TerminalInputParser::ParseMouse(
408TerminalInputParser::Output TerminalInputParser::ParseCursorReporting(
413 Output
output(CURSOR_REPORTING);
std::unique_ptr< SenderImpl< T > > Sender
const std::map< std::string, std::string > g_uniformize
Component Slider(SliderOption< T > options)
A slider in any direction.
static Event Special(std::string)
An custom event whose meaning is defined by the user of the library.