FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
event.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4#include <cstddef>
5#include <initializer_list>
6#include <map> // for map
7#include <memory>
8#include <string>
9#include <string_view>
10#include <utility> // for move
11#include <vector>
12
14#include "ftxui/component/mouse.hpp" // for Mouse
15#include "ftxui/screen/string.hpp" // for to_wstring
16
17// Disable warning for shadowing variable, for every compilers. Indeed, there is
18// a static Event for every letter of the alphabet:
19#ifdef __clang__
20#pragma clang diagnostic ignored "-Wshadow"
21#elif __GNUC__
22#pragma GCC diagnostic ignored "-Wshadow"
23#elif defined(_MSC_VER)
24#pragma warning(disable : 6244)
25#pragma warning(disable : 6246)
26#endif
27
28namespace ftxui {
29
30/// @brief An event corresponding to a given typed character.
31/// @param input The character typed by the user.
32// static
33Event Event::Character(std::string_view input) {
34 Event event;
35 event.input_ = std::string(input);
36 event.type_ = Type::Character;
37 return event;
38}
39
40/// @brief An event corresponding to a given typed character.
41/// @param c The character typed by the user.
42// static
43Event Event::Character(char c) {
44 return Event::Character(std::string{c});
45}
46
47/// @brief An event corresponding to a given typed character.
48/// @param c The character typed by the user.
49// static
50Event Event::Character(wchar_t c) {
51 return Event::Character(to_string(std::wstring{c}));
52}
53
54/// @brief An event corresponding to a given typed character.
55/// @param input The sequence of character send by the terminal.
56/// @param mouse The mouse state.
57// static
58Event Event::Mouse(std::string_view input, struct Mouse mouse) {
59 Event event;
60 event.input_ = std::string(input);
61 event.type_ = Type::Mouse;
62 event.data_.mouse = mouse; // NOLINT
63 return event;
64}
65
66/// @brief An event corresponding to a terminal DCS (Device Control String).
67// static
68Event Event::CursorShape(std::string_view input, int shape) {
69 Event event;
70 event.input_ = std::string(input);
71 event.type_ = Type::CursorShape;
72 event.data_.cursor_shape = shape; // NOLINT
73 return event;
74}
75
76/// @brief An event corresponding to a terminal name and version report.
77// static
78Event Event::TerminalNameVersion(std::string_view input,
79 std::string name,
80 int version) {
81 Event event;
82 event.input_ = std::string(input);
83 event.type_ = Type::TerminalNameVersion;
84 event.terminal_name_ = std::make_shared<std::string>(std::move(name));
85 event.data_.terminal_version = version;
86 return event;
87}
88
89/// @brief An event corresponding to a terminal emulator report.
90// static
91Event Event::TerminalEmulator(std::string_view input,
92 std::string name,
93 std::string version) {
94 Event event;
95 event.input_ = std::string(input);
96 event.type_ = Type::TerminalEmulator;
97 event.terminal_name_ = std::make_shared<std::string>(std::move(name));
98 event.terminal_emulator_version_ =
99 std::make_shared<std::string>(std::move(version));
100 return event;
101}
102
103/// @brief An event corresponding to a terminal capabilities report.
104// static
105Event Event::TerminalCapabilities(std::string_view input,
106 std::vector<int> capabilities) {
107 Event event;
108 event.input_ = std::string(input);
109 event.type_ = Type::TerminalCapabilities;
110 event.terminal_capabilities_ =
111 std::make_shared<std::vector<int>>(std::move(capabilities));
112 return event;
113}
114
115/// @brief Return the names of the terminal capabilities.
116std::vector<std::string> Event::TerminalCapabilityNames() const {
117 if (type_ != Type::TerminalCapabilities) {
118 return {};
119 }
120
121 std::vector<std::string> names;
122 for (const int cap : *terminal_capabilities_) {
123 switch (cap) {
124 case 0:
125 break;
126 case 1:
127 names.emplace_back("132-columns");
128 break;
129 case 2:
130 names.emplace_back("Printer-port");
131 break;
132 case 3:
133 names.emplace_back("ReGIS-graphics");
134 break;
135 case 4:
136 names.emplace_back("Sixel-graphics");
137 break;
138 case 6:
139 names.emplace_back("Selective-erase");
140 break;
141 case 7:
142 names.emplace_back("Soft-character-set-(DRCS)");
143 break;
144 case 8:
145 names.emplace_back("User-defined-keys-(UDK)");
146 break;
147 case 9:
148 names.emplace_back("National-replacement-character-sets-(NRC)");
149 break;
150 case 12:
151 names.emplace_back("Local-editing");
152 break;
153 case 15:
154 names.emplace_back("Technical-character-set");
155 break;
156 case 18:
157 names.emplace_back("Windowing-capability");
158 break;
159 case 21:
160 names.emplace_back("Horizontal-scrolling");
161 break;
162 case 22:
163 names.emplace_back("ANSI-color");
164 break;
165 case 28:
166 names.emplace_back("Font-loading");
167 break;
168 case 29:
169 names.emplace_back("ANSI-text-locator-(Mouse)");
170 break;
171 case 52:
172 names.emplace_back("UTF-8");
173 break;
174 case 61:
175 names.emplace_back("VT510");
176 break;
177 case 62:
178 names.emplace_back("VT220");
179 break;
180 case 63:
181 names.emplace_back("VT320");
182 break;
183 case 64:
184 names.emplace_back("VT420");
185 break;
186 case 65:
187 names.emplace_back("VT525");
188 break;
189 default:
190 names.emplace_back("Unknown-" + std::to_string(cap));
191 break;
192 }
193 }
194 return names;
195}
196
197/// @brief Whether the event is a terminal name and version report.
199 return type_ == Type::TerminalNameVersion;
200}
201
202/// @brief Return the terminal name.
203const std::string& Event::TerminalName() const {
204 return *terminal_name_;
205}
206
207/// @brief Return the terminal version.
209 return data_.terminal_version;
210}
211
212/// @brief Whether the event is a terminal capabilities report.
214 return type_ == Type::TerminalCapabilities;
215}
216
217/// @brief Return the terminal capabilities.
218const std::vector<int>& Event::TerminalCapabilities() const {
219 return *terminal_capabilities_;
220}
221
222/// @brief Whether the event is a terminal emulator report.
224 return type_ == Type::TerminalEmulator;
225}
226
227/// @brief Return the terminal emulator name.
228const std::string& Event::TerminalEmulatorName() const {
229 return *terminal_name_;
230}
231
232/// @brief Return the terminal emulator version.
233const std::string& Event::TerminalEmulatorVersion() const {
234 return *terminal_emulator_version_;
235}
236
237/// @brief An custom event whose meaning is defined by the user of the library.
238/// @param input An arbitrary sequence of character defined by the developer.
239// static
240Event Event::Special(std::string_view input) {
241 Event event;
242 event.input_ = std::string(input);
243 return event;
244}
245
246/// @brief An custom event whose meaning is defined by the user of the library.
247/// @param input An arbitrary sequence of character defined by the developer.
248// static
249Event Event::Special(std::initializer_list<char> input) {
250 return Event::Special(std::string(input));
251}
252
253/// @internal
254// static
255Event Event::CursorPosition(std::string_view input, int x, int y) {
256 Event event;
257 event.input_ = std::string(input);
258 event.type_ = Type::CursorPosition;
259 event.data_.cursor = {x, y}; // NOLINT
260 return event;
261}
262
263/// @brief Return a string representation of the event.
264std::string Event::DebugString() const {
265 static std::map<Event, const char*> event_to_string = {
266 // --- Arrow ---
267 {Event::ArrowLeft, "Event::ArrowLeft"},
268 {Event::ArrowRight, "Event::ArrowRight"},
269 {Event::ArrowUp, "Event::ArrowUp"},
270 {Event::ArrowDown, "Event::ArrowDown"},
271
272 // --- ArrowCtrl ---
273 {Event::ArrowLeftCtrl, "Event::ArrowLeftCtrl"},
274 {Event::ArrowRightCtrl, "Event::ArrowRightCtrl"},
275 {Event::ArrowUpCtrl, "Event::ArrowUpCtrl"},
276 {Event::ArrowDownCtrl, "Event::ArrowDownCtrl"},
277
278 // --- Other ---
279 {Event::Backspace, "Event::Backspace"},
280 {Event::Delete, "Event::Delete"},
281 {Event::Escape, "Event::Escape"},
282 {Event::Return, "Event::Return"},
283 {Event::Tab, "Event::Tab"},
284 {Event::TabReverse, "Event::TabReverse"},
285
286 // --- Function keys ---
287 {Event::F1, "Event::F1"},
288 {Event::F2, "Event::F2"},
289 {Event::F3, "Event::F3"},
290 {Event::F4, "Event::F4"},
291 {Event::F5, "Event::F5"},
292 {Event::F6, "Event::F6"},
293 {Event::F7, "Event::F7"},
294 {Event::F8, "Event::F8"},
295 {Event::F9, "Event::F9"},
296 {Event::F10, "Event::F10"},
297 {Event::F11, "Event::F11"},
298 {Event::F12, "Event::F12"},
299
300 // --- Navigation keys ---
301 {Event::Insert, "Event::Insert"},
302 {Event::Home, "Event::Home"},
303 {Event::End, "Event::End"},
304 {Event::PageUp, "Event::PageUp"},
305 {Event::PageDown, "Event::PageDown"},
306
307 // --- Control keys ---
308 {Event::CtrlA, "Event::CtrlA"},
309 {Event::CtrlB, "Event::CtrlB"},
310 {Event::CtrlC, "Event::CtrlC"},
311 {Event::CtrlD, "Event::CtrlD"},
312 {Event::CtrlE, "Event::CtrlE"},
313 {Event::CtrlF, "Event::CtrlF"},
314 {Event::CtrlG, "Event::CtrlG"},
315 {Event::CtrlH, "Event::CtrlH"},
316 {Event::CtrlI, "Event::CtrlI"},
317 {Event::CtrlJ, "Event::CtrlJ"},
318 {Event::CtrlK, "Event::CtrlK"},
319 {Event::CtrlL, "Event::CtrlL"},
320 {Event::CtrlM, "Event::CtrlM"},
321 {Event::CtrlN, "Event::CtrlN"},
322 {Event::CtrlO, "Event::CtrlO"},
323 {Event::CtrlP, "Event::CtrlP"},
324 {Event::CtrlQ, "Event::CtrlQ"},
325 {Event::CtrlR, "Event::CtrlR"},
326 {Event::CtrlS, "Event::CtrlS"},
327 {Event::CtrlT, "Event::CtrlT"},
328 {Event::CtrlU, "Event::CtrlU"},
329 {Event::CtrlV, "Event::CtrlV"},
330 {Event::CtrlW, "Event::CtrlW"},
331 {Event::CtrlX, "Event::CtrlX"},
332 {Event::CtrlY, "Event::CtrlY"},
333 {Event::CtrlZ, "Event::CtrlZ"},
334
335 // --- Alt keys ---
336 {Event::AltA, "Event::AltA"},
337 {Event::AltB, "Event::AltB"},
338 {Event::AltC, "Event::AltC"},
339 {Event::AltD, "Event::AltD"},
340 {Event::AltE, "Event::AltE"},
341 {Event::AltF, "Event::AltF"},
342 {Event::AltG, "Event::AltG"},
343 {Event::AltH, "Event::AltH"},
344 {Event::AltI, "Event::AltI"},
345 {Event::AltJ, "Event::AltJ"},
346 {Event::AltK, "Event::AltK"},
347 {Event::AltL, "Event::AltL"},
348 {Event::AltM, "Event::AltM"},
349 {Event::AltN, "Event::AltN"},
350 {Event::AltO, "Event::AltO"},
351 {Event::AltP, "Event::AltP"},
352 {Event::AltQ, "Event::AltQ"},
353 {Event::AltR, "Event::AltR"},
354 {Event::AltS, "Event::AltS"},
355 {Event::AltT, "Event::AltT"},
356 {Event::AltU, "Event::AltU"},
357 {Event::AltV, "Event::AltV"},
358 {Event::AltW, "Event::AltW"},
359 {Event::AltX, "Event::AltX"},
360 {Event::AltY, "Event::AltY"},
361 {Event::AltZ, "Event::AltZ"},
362
363 // --- CtrlAlt keys ---
364 {Event::CtrlAltA, "Event::CtrlAltA"},
365 {Event::CtrlAltB, "Event::CtrlAltB"},
366 {Event::CtrlAltC, "Event::CtrlAltC"},
367 {Event::CtrlAltD, "Event::CtrlAltD"},
368 {Event::CtrlAltE, "Event::CtrlAltE"},
369 {Event::CtrlAltF, "Event::CtrlAltF"},
370 {Event::CtrlAltG, "Event::CtrlAltG"},
371 {Event::CtrlAltH, "Event::CtrlAltH"},
372 {Event::CtrlAltI, "Event::CtrlAltI"},
373 {Event::CtrlAltJ, "Event::CtrlAltJ"},
374 {Event::CtrlAltK, "Event::CtrlAltK"},
375 {Event::CtrlAltL, "Event::CtrlAltL"},
376 {Event::CtrlAltM, "Event::CtrlAltM"},
377 {Event::CtrlAltN, "Event::CtrlAltN"},
378 {Event::CtrlAltO, "Event::CtrlAltO"},
379 {Event::CtrlAltP, "Event::CtrlAltP"},
380 {Event::CtrlAltQ, "Event::CtrlAltQ"},
381 {Event::CtrlAltR, "Event::CtrlAltR"},
382 {Event::CtrlAltS, "Event::CtrlAltS"},
383 {Event::CtrlAltT, "Event::CtrlAltT"},
384 {Event::CtrlAltU, "Event::CtrlAltU"},
385 {Event::CtrlAltV, "Event::CtrlAltV"},
386 {Event::CtrlAltW, "Event::CtrlAltW"},
387 {Event::CtrlAltX, "Event::CtrlAltX"},
388 {Event::CtrlAltY, "Event::CtrlAltY"},
389 {Event::CtrlAltZ, "Event::CtrlAltZ"},
390
391 // --- Custom ---
392 {Event::Custom, "Event::Custom"},
393 };
394
395 static std::map<Mouse::Button, const char*> mouse_button_string = {
396 {Mouse::Button::Left, ".button = Mouse::Left"},
397 {Mouse::Button::Middle, ".button = Mouse::Middle"},
398 {Mouse::Button::Right, ".button = Mouse::Right"},
399 {Mouse::Button::WheelUp, ".button = Mouse::WheelUp"},
400 {Mouse::Button::WheelDown, ".button = Mouse::WheelDown"},
401 {Mouse::Button::None, ".button = Mouse::None"},
402 {Mouse::Button::WheelLeft, ".button = Mouse::WheelLeft"},
403 {Mouse::Button::WheelRight, ".button = Mouse::WheelRight"},
404 };
405
406 static std::map<Mouse::Motion, const char*> mouse_motion_string = {
407 {Mouse::Motion::Pressed, ".motion = Mouse::Pressed"},
408 {Mouse::Motion::Released, ".motion = Mouse::Released"},
409 {Mouse::Motion::Moved, ".motion = Mouse::Moved"},
410 };
411
412 switch (type_) {
413 case Type::Character: {
414 return "Event::Character(\"" + input_ + "\")";
415 }
416 case Type::Mouse: {
417 std::string out = "Event::Mouse(\"...\", Mouse{";
418 out += std::string(mouse_button_string[data_.mouse.button]);
419 out += ", ";
420 out += std::string(mouse_motion_string[data_.mouse.motion]);
421 out += ", ";
422 if (data_.mouse.shift) {
423 out += ".shift = true, ";
424 }
425 if (data_.mouse.meta) {
426 out += ".meta = true, ";
427 }
428 if (data_.mouse.control) {
429 out += ".control = true, ";
430 }
431 out += ".x = " + std::to_string(data_.mouse.x);
432 out += ", ";
433 out += ".y = " + std::to_string(data_.mouse.y);
434 out += "})";
435 return out;
436 }
437 case Type::CursorShape:
438 return "Event::CursorShape(" + input_ + ", " +
439 std::to_string(data_.cursor_shape) + ")";
440 case Type::CursorPosition:
441 return "Event::CursorPosition(" + input_ + ", " +
442 std::to_string(data_.cursor.x) + ", " +
443 std::to_string(data_.cursor.y) + ")";
444 case Type::TerminalNameVersion:
445 return "Event::TerminalNameVersion(" + input_ + ", " + *terminal_name_ +
446 ", " + std::to_string(data_.terminal_version) + ")";
447 case Type::TerminalEmulator:
448 return "Event::TerminalEmulator(" + input_ + ", " + *terminal_name_ +
449 ", " + *terminal_emulator_version_ + ")";
450 case Type::TerminalCapabilities: {
451 std::string out = "Event::TerminalCapabilities(" + input_ + ", {";
452 for (size_t i = 0; i < terminal_capabilities_->size(); ++i) {
453 out += std::to_string((*terminal_capabilities_)[i]);
454 if (i + 1 < terminal_capabilities_->size()) {
455 out += ", ";
456 }
457 }
458 out += "})";
459 return out;
460 }
461 default: {
462 auto event_it = event_to_string.find(*this);
463 if (event_it != event_to_string.end()) {
464 return event_it->second;
465 }
466
467 return "";
468 }
469 }
470 return "";
471}
472
473// clang-format off
474// NOLINTBEGIN
475
476// --- Arrow ---
477const Event Event::ArrowLeft = Event::Special("\x1B[D");
478const Event Event::ArrowRight = Event::Special("\x1B[C");
479const Event Event::ArrowUp = Event::Special("\x1B[A");
480const Event Event::ArrowDown = Event::Special("\x1B[B");
481const Event Event::ArrowLeftCtrl = Event::Special("\x1B[1;5D");
482const Event Event::ArrowRightCtrl = Event::Special("\x1B[1;5C");
483const Event Event::ArrowUpCtrl = Event::Special("\x1B[1;5A");
484const Event Event::ArrowDownCtrl = Event::Special("\x1B[1;5B");
486const Event Event::Delete = Event::Special("\x1B[3~");
487const Event Event::Escape = Event::Special("\x1B");
488const Event Event::Return = Event::Special({10});
489const Event Event::Tab = Event::Special({9});
490const Event Event::TabReverse = Event::Special({27, 91, 90});
491
492// See https://invisible-island.net/xterm/xterm-function-keys.html
493// We follow xterm-new / vterm-xf86-v4 / mgt / screen
494const Event Event::F1 = Event::Special("\x1BOP");
495const Event Event::F2 = Event::Special("\x1BOQ");
496const Event Event::F3 = Event::Special("\x1BOR");
497const Event Event::F4 = Event::Special("\x1BOS");
498const Event Event::F5 = Event::Special("\x1B[15~");
499const Event Event::F6 = Event::Special("\x1B[17~");
500const Event Event::F7 = Event::Special("\x1B[18~");
501const Event Event::F8 = Event::Special("\x1B[19~");
502const Event Event::F9 = Event::Special("\x1B[20~");
503const Event Event::F10 = Event::Special("\x1B[21~");
504const Event Event::F11 = Event::Special("\x1B[23~");
505const Event Event::F12 = Event::Special("\x1B[24~");
506
507const Event Event::Insert = Event::Special("\x1B[2~");
508const Event Event::Home = Event::Special({27, 91, 72});
509const Event Event::End = Event::Special({27, 91, 70});
510const Event Event::PageUp = Event::Special({27, 91, 53, 126});
511const Event Event::PageDown = Event::Special({27, 91, 54, 126});
512const Event Event::Custom = Event::Special({0});
513
514const Event Event::a = Event::Character("a");
515const Event Event::b = Event::Character("b");
516const Event Event::c = Event::Character("c");
517const Event Event::d = Event::Character("d");
518const Event Event::e = Event::Character("e");
519const Event Event::f = Event::Character("f");
520const Event Event::g = Event::Character("g");
521const Event Event::h = Event::Character("h");
522const Event Event::i = Event::Character("i");
523const Event Event::j = Event::Character("j");
524const Event Event::k = Event::Character("k");
525const Event Event::l = Event::Character("l");
526const Event Event::m = Event::Character("m");
527const Event Event::n = Event::Character("n");
528const Event Event::o = Event::Character("o");
529const Event Event::p = Event::Character("p");
530const Event Event::q = Event::Character("q");
531const Event Event::r = Event::Character("r");
532const Event Event::s = Event::Character("s");
533const Event Event::t = Event::Character("t");
534const Event Event::u = Event::Character("u");
535const Event Event::v = Event::Character("v");
536const Event Event::w = Event::Character("w");
537const Event Event::x = Event::Character("x");
538const Event Event::y = Event::Character("y");
539const Event Event::z = Event::Character("z");
540
541const Event Event::A = Event::Character("A");
542const Event Event::B = Event::Character("B");
543const Event Event::C = Event::Character("C");
544const Event Event::D = Event::Character("D");
545const Event Event::E = Event::Character("E");
546const Event Event::F = Event::Character("F");
547const Event Event::G = Event::Character("G");
548const Event Event::H = Event::Character("H");
549const Event Event::I = Event::Character("I");
550const Event Event::J = Event::Character("J");
551const Event Event::K = Event::Character("K");
552const Event Event::L = Event::Character("L");
553const Event Event::M = Event::Character("M");
554const Event Event::N = Event::Character("N");
555const Event Event::O = Event::Character("O");
556const Event Event::P = Event::Character("P");
557const Event Event::Q = Event::Character("Q");
558const Event Event::R = Event::Character("R");
559const Event Event::S = Event::Character("S");
560const Event Event::T = Event::Character("T");
561const Event Event::U = Event::Character("U");
562const Event Event::V = Event::Character("V");
563const Event Event::W = Event::Character("W");
564const Event Event::X = Event::Character("X");
565const Event Event::Y = Event::Character("Y");
566const Event Event::Z = Event::Character("Z");
567
568const Event Event::CtrlA = Event::Special("\x01");
569const Event Event::CtrlB = Event::Special("\x02");
570const Event Event::CtrlC = Event::Special("\x03");
571const Event Event::CtrlD = Event::Special("\x04");
572const Event Event::CtrlE = Event::Special("\x05");
573const Event Event::CtrlF = Event::Special("\x06");
574const Event Event::CtrlG = Event::Special("\x07");
575const Event Event::CtrlH = Event::Special("\x08");
576const Event Event::CtrlI = Event::Special("\x09");
577const Event Event::CtrlJ = Event::Special("\x0a");
578const Event Event::CtrlK = Event::Special("\x0b");
579const Event Event::CtrlL = Event::Special("\x0c");
580const Event Event::CtrlM = Event::Special("\x0d");
581const Event Event::CtrlN = Event::Special("\x0e");
582const Event Event::CtrlO = Event::Special("\x0f");
583const Event Event::CtrlP = Event::Special("\x10");
584const Event Event::CtrlQ = Event::Special("\x11");
585const Event Event::CtrlR = Event::Special("\x12");
586const Event Event::CtrlS = Event::Special("\x13");
587const Event Event::CtrlT = Event::Special("\x14");
588const Event Event::CtrlU = Event::Special("\x15");
589const Event Event::CtrlV = Event::Special("\x16");
590const Event Event::CtrlW = Event::Special("\x17");
591const Event Event::CtrlX = Event::Special("\x18");
592const Event Event::CtrlY = Event::Special("\x19");
593const Event Event::CtrlZ = Event::Special("\x1a");
594
595const Event Event::AltA = Event::Special("\x1b""a");
596const Event Event::AltB = Event::Special("\x1b""b");
597const Event Event::AltC = Event::Special("\x1b""c");
598const Event Event::AltD = Event::Special("\x1b""d");
599const Event Event::AltE = Event::Special("\x1b""e");
600const Event Event::AltF = Event::Special("\x1b""f");
601const Event Event::AltG = Event::Special("\x1b""g");
602const Event Event::AltH = Event::Special("\x1b""h");
603const Event Event::AltI = Event::Special("\x1b""i");
604const Event Event::AltJ = Event::Special("\x1b""j");
605const Event Event::AltK = Event::Special("\x1b""k");
606const Event Event::AltL = Event::Special("\x1b""l");
607const Event Event::AltM = Event::Special("\x1b""m");
608const Event Event::AltN = Event::Special("\x1b""n");
609const Event Event::AltO = Event::Special("\x1b""o");
610const Event Event::AltP = Event::Special("\x1b""p");
611const Event Event::AltQ = Event::Special("\x1b""q");
612const Event Event::AltR = Event::Special("\x1b""r");
613const Event Event::AltS = Event::Special("\x1b""s");
614const Event Event::AltT = Event::Special("\x1b""t");
615const Event Event::AltU = Event::Special("\x1b""u");
616const Event Event::AltV = Event::Special("\x1b""v");
617const Event Event::AltW = Event::Special("\x1b""w");
618const Event Event::AltX = Event::Special("\x1b""x");
619const Event Event::AltY = Event::Special("\x1b""y");
620const Event Event::AltZ = Event::Special("\x1b""z");
621
622const Event Event::CtrlAltA = Event::Special("\x1b\x01");
623const Event Event::CtrlAltB = Event::Special("\x1b\x02");
624const Event Event::CtrlAltC = Event::Special("\x1b\x03");
625const Event Event::CtrlAltD = Event::Special("\x1b\x04");
626const Event Event::CtrlAltE = Event::Special("\x1b\x05");
627const Event Event::CtrlAltF = Event::Special("\x1b\x06");
628const Event Event::CtrlAltG = Event::Special("\x1b\x07");
629const Event Event::CtrlAltH = Event::Special("\x1b\x08");
630const Event Event::CtrlAltI = Event::Special("\x1b\x09");
631const Event Event::CtrlAltJ = Event::Special("\x1b\x0a");
632const Event Event::CtrlAltK = Event::Special("\x1b\x0b");
633const Event Event::CtrlAltL = Event::Special("\x1b\x0c");
634const Event Event::CtrlAltM = Event::Special("\x1b\x0d");
635const Event Event::CtrlAltN = Event::Special("\x1b\x0e");
636const Event Event::CtrlAltO = Event::Special("\x1b\x0f");
637const Event Event::CtrlAltP = Event::Special("\x1b\x10");
638const Event Event::CtrlAltQ = Event::Special("\x1b\x11");
639const Event Event::CtrlAltR = Event::Special("\x1b\x12");
640const Event Event::CtrlAltS = Event::Special("\x1b\x13");
641const Event Event::CtrlAltT = Event::Special("\x1b\x14");
642const Event Event::CtrlAltU = Event::Special("\x1b\x15");
643const Event Event::CtrlAltV = Event::Special("\x1b\x16");
644const Event Event::CtrlAltW = Event::Special("\x1b\x17");
645const Event Event::CtrlAltX = Event::Special("\x1b\x18");
646const Event Event::CtrlAltY = Event::Special("\x1b\x19");
647const Event Event::CtrlAltZ = Event::Special("\x1b\x1a");
648
649// NOLINTEND
650// clang-format on
651
652} // namespace ftxui
static const Event TabReverse
Definition event.hpp:68
static const Event j
Definition event.hpp:90
static const Event CtrlC
Definition event.hpp:83
@ WheelRight
Supported terminal only.
Definition mouse.hpp:20
static const Event CtrlP
Definition event.hpp:96
static const Event CtrlV
Definition event.hpp:102
static const Event ArrowLeftCtrl
Definition event.hpp:57
static const Event CtrlL
Definition event.hpp:92
static const Event AltT
Definition event.hpp:100
bool IsTerminalEmulator() const
Whether the event is a terminal emulator report.
Definition event.cpp:223
static const Event w
Definition event.hpp:103
static const Event CtrlAltX
Definition event.hpp:104
static const Event D
Definition event.hpp:84
static const Event CtrlAltN
Definition event.hpp:94
static const Event a
Definition event.hpp:81
static const Event AltH
Definition event.hpp:88
static const Event AltF
Definition event.hpp:86
static const Event K
Definition event.hpp:91
static const Event T
Definition event.hpp:100
static const Event CtrlAltC
Definition event.hpp:83
static const Event X
Definition event.hpp:104
static const Event CtrlE
Definition event.hpp:85
static const Event Q
Definition event.hpp:97
static const Event u
Definition event.hpp:101
static const Event PageUp
Definition event.hpp:74
static const Event h
Definition event.hpp:88
static const Event CtrlAltF
Definition event.hpp:86
static const Event CtrlZ
Definition event.hpp:106
static const Event J
Definition event.hpp:90
static const Event CtrlU
Definition event.hpp:101
static const Event AltQ
Definition event.hpp:97
static const Event b
Definition event.hpp:82
static const Event Escape
Definition event.hpp:66
static const Event AltY
Definition event.hpp:105
static const Event CtrlAltI
Definition event.hpp:89
static const Event AltL
Definition event.hpp:92
static const Event AltW
Definition event.hpp:103
static const Event F12
Definition event.hpp:78
static const Event E
Definition event.hpp:85
static const Event m
Definition event.hpp:93
static const Event N
Definition event.hpp:94
static const Event CtrlAltP
Definition event.hpp:96
static const Event CtrlAltE
Definition event.hpp:85
static const Event F5
Definition event.hpp:78
static const Event CtrlF
Definition event.hpp:86
static const Event F3
Definition event.hpp:78
static const Event CtrlAltJ
Definition event.hpp:90
static const Event z
Definition event.hpp:106
static const Event AltK
Definition event.hpp:91
static const Event B
Definition event.hpp:82
static const Event H
Definition event.hpp:88
int TerminalVersion() const
Return the terminal version.
Definition event.cpp:208
static const Event CtrlX
Definition event.hpp:104
static const Event F9
Definition event.hpp:78
static const Event AltC
Definition event.hpp:83
static const Event CtrlB
Definition event.hpp:82
std::vector< std::string > TerminalCapabilityNames() const
Return the names of the terminal capabilities.
Definition event.cpp:116
static const Event CtrlAltH
Definition event.hpp:88
static const Event O
Definition event.hpp:95
bool IsTerminalCapabilities() const
Whether the event is a terminal capabilities report.
Definition event.cpp:213
static const Event R
Definition event.hpp:98
static const Event AltM
Definition event.hpp:93
static const Event CtrlR
Definition event.hpp:98
static const Event CtrlAltW
Definition event.hpp:103
static Event Special(std::string_view)
An custom event whose meaning is defined by the user of the library.
Definition event.cpp:240
static const Event CtrlAltO
Definition event.hpp:95
bool IsTerminalNameVersion() const
Whether the event is a terminal name and version report.
Definition event.cpp:198
static const Event CtrlY
Definition event.hpp:105
static const Event Custom
Definition event.hpp:109
static const Event A
Definition event.hpp:81
static const Event AltG
Definition event.hpp:87
static const Event p
Definition event.hpp:96
static const Event l
Definition event.hpp:92
static const Event CtrlH
Definition event.hpp:88
struct Mouse mouse
Definition event.hpp:171
std::string DebugString() const
Return a string representation of the event.
Definition event.cpp:264
static const Event AltO
Definition event.hpp:95
static const Event CtrlJ
Definition event.hpp:90
static const Event CtrlAltM
Definition event.hpp:93
static const Event CtrlS
Definition event.hpp:99
const std::string & TerminalName() const
Return the terminal name.
Definition event.cpp:203
static const Event Z
Definition event.hpp:106
static const Event AltR
Definition event.hpp:98
static const Event CtrlW
Definition event.hpp:103
static const Event CtrlN
Definition event.hpp:94
static const Event F2
Definition event.hpp:78
static const Event CtrlM
Definition event.hpp:93
static const Event G
Definition event.hpp:87
static const Event Backspace
Definition event.hpp:63
static const Event d
Definition event.hpp:84
static const Event CtrlAltR
Definition event.hpp:98
static const Event CtrlK
Definition event.hpp:91
static const Event x
Definition event.hpp:104
static const Event F7
Definition event.hpp:78
static const Event ArrowUp
Definition event.hpp:54
const std::string & input() const
Definition event.hpp:116
static const Event Tab
Definition event.hpp:67
static const Event r
Definition event.hpp:98
static const Event AltU
Definition event.hpp:101
static const Event CtrlQ
Definition event.hpp:97
static const Event CtrlAltZ
Definition event.hpp:106
static const Event AltN
Definition event.hpp:94
static const Event AltA
Definition event.hpp:81
static const Event ArrowDown
Definition event.hpp:55
static const Event End
Definition event.hpp:73
static const Event F11
Definition event.hpp:78
static const Event CtrlG
Definition event.hpp:87
static const Event n
Definition event.hpp:94
static const Event q
Definition event.hpp:97
static const Event AltZ
Definition event.hpp:106
static const Event Home
Definition event.hpp:72
static const Event C
Definition event.hpp:83
static const Event AltD
Definition event.hpp:84
static const Event CtrlAltY
Definition event.hpp:105
static const Event AltJ
Definition event.hpp:90
static const Event F8
Definition event.hpp:78
static const Event CtrlAltL
Definition event.hpp:92
static const Event U
Definition event.hpp:101
const std::string & TerminalEmulatorVersion() const
Return the terminal emulator version.
Definition event.cpp:233
static const Event o
Definition event.hpp:95
static const Event AltB
Definition event.hpp:82
static const Event F4
Definition event.hpp:78
static const Event t
Definition event.hpp:100
static const Event y
Definition event.hpp:105
static const Event ArrowUpCtrl
Definition event.hpp:59
static const Event k
Definition event.hpp:91
static const Event CtrlAltS
Definition event.hpp:99
static const Event s
Definition event.hpp:99
static const Event I
Definition event.hpp:89
static const Event CtrlT
Definition event.hpp:100
static const Event F
Definition event.hpp:86
static const Event AltI
Definition event.hpp:89
static const Event F10
Definition event.hpp:78
const std::vector< int > & TerminalCapabilities() const
Return the terminal capabilities.
Definition event.cpp:218
static const Event AltP
Definition event.hpp:96
static const Event PageDown
Definition event.hpp:75
static const Event Y
Definition event.hpp:105
static const Event CtrlAltK
Definition event.hpp:91
static const Event F6
Definition event.hpp:78
static const Event CtrlAltG
Definition event.hpp:87
static const Event CtrlA
Definition event.hpp:81
static const Event i
Definition event.hpp:89
static const Event AltS
Definition event.hpp:99
static const Event g
Definition event.hpp:87
static const Event F1
Definition event.hpp:78
static const Event S
Definition event.hpp:99
static const Event Return
Definition event.hpp:65
static const Event CtrlAltU
Definition event.hpp:101
static const Event V
Definition event.hpp:102
const std::string & TerminalEmulatorName() const
Return the terminal emulator name.
Definition event.cpp:228
static const Event CtrlAltT
Definition event.hpp:100
static const Event CtrlAltA
Definition event.hpp:81
static const Event AltE
Definition event.hpp:85
static const Event P
Definition event.hpp:96
static const Event CtrlD
Definition event.hpp:84
static const Event ArrowLeft
Definition event.hpp:52
static const Event CtrlAltB
Definition event.hpp:82
static const Event AltV
Definition event.hpp:102
static const Event v
Definition event.hpp:102
static const Event e
Definition event.hpp:85
static const Event CtrlO
Definition event.hpp:95
static const Event Delete
Definition event.hpp:64
static const Event CtrlAltV
Definition event.hpp:102
static const Event ArrowDownCtrl
Definition event.hpp:60
static const Event AltX
Definition event.hpp:104
static const Event CtrlAltD
Definition event.hpp:84
static const Event L
Definition event.hpp:92
static const Event W
Definition event.hpp:103
static const Event f
Definition event.hpp:86
static const Event Insert
Definition event.hpp:71
static const Event CtrlI
Definition event.hpp:89
static const Event ArrowRightCtrl
Definition event.hpp:58
static const Event c
Definition event.hpp:83
static const Event CtrlAltQ
Definition event.hpp:97
static const Event M
Definition event.hpp:93
static const Event ArrowRight
Definition event.hpp:53
Represent an event. It can be key press event, a terminal resize, or more ...
Definition event.hpp:32
A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift,...
Definition mouse.hpp:11
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
std::string to_string(std::wstring_view s)
Convert a std::wstring into a UTF8 std::string.
Definition string.cpp:1594