108 case Type::Empty:
break;
109 case Type::Key: m_container.m_Key =
event.m_container.m_Key;
break;
110 case Type::CopyPaste:
new(&this->m_container.m_string) std::string(event.
m_container.
m_string);
break;
111 case Type::Cursor: m_container.m_Cursor =
event.m_container.m_Cursor;
break;
112 case Type::Screen: m_container.m_Screen =
event.m_container.m_Screen;
break;
113 case Type::Focus: m_container.m_Focus =
event.m_container.m_Focus;
break;
114 case Type::Mouse: m_container.m_Mouse =
event.m_container.m_Mouse;
break;
124 m_Type =
event.m_Type;
127 case Type::Empty:
break;
128 case Type::Key: m_container.m_Key =
event.m_container.m_Key;
break;
129 case Type::CopyPaste:
new(&this->m_container.m_string) std::string(event.
m_container.
m_string);
break;
130 case Type::Cursor: m_container.m_Cursor =
event.m_container.m_Cursor;
break;
131 case Type::Screen: m_container.m_Screen =
event.m_container.m_Screen;
break;
132 case Type::Focus: m_container.m_Focus =
event.m_container.m_Focus;
break;
133 case Type::Mouse: m_container.m_Mouse =
event.m_container.m_Mouse;
break;
150 case Type::Empty:
break;
151 case Type::Key: std::swap(m_container.m_Key, event.m_container.m_Key);
break;
152 case Type::CopyPaste: std::swap(m_container.m_string, event.m_container.m_string);
break;
153 case Type::Cursor: std::swap(m_container.m_Cursor, event.m_container.m_Cursor);
break;
154 case Type::Screen: std::swap(m_container.m_Screen, event.m_container.m_Screen);
break;
155 case Type::Focus: std::swap(m_container.m_Focus, event.m_container.m_Focus);
break;
156 case Type::Mouse: std::swap(m_container.m_Mouse, event.m_container.m_Mouse);
break;
165 case Type::Empty:
break;
166 case Type::Key: std::swap(m_container.m_Key, other.m_container.m_Key);
break;
167 case Type::CopyPaste: std::swap(m_container.m_string, other.m_container.m_string);
break;
168 case Type::Cursor: std::swap(m_container.m_Cursor, other.m_container.m_Cursor);
break;
169 case Type::Screen: std::swap(m_container.m_Screen, other.m_container.m_Screen);
break;
170 case Type::Focus: std::swap(m_container.m_Focus, other.m_container.m_Focus);
break;
171 case Type::Mouse: std::swap(m_container.m_Mouse, other.m_container.m_Mouse);
break;
209 if(str.empty()) m_Type = Type::Empty;
210 else if(str.size() == 1)
213 m_container.m_Key =
Key(
static_cast<Term::Key>(str[0]));
217 else if(str ==
"\033[I")
219 m_Type = Type::Focus;
222 else if(str ==
"\033[O")
224 m_Type = Type::Focus;
227 else if(str.size() == 2 && str[0] ==
'\033')
232 else if(str[0] ==
'\033' && str[1] ==
'[' && str[str.size() - 1] ==
'R')
234 std::size_t found = str.find(
';', 2);
235 if(found != std::string::npos)
237 m_Type = Type::Cursor;
238 m_container.m_Cursor =
Cursor(
static_cast<std::uint16_t
>(std::stoi(str.substr(2, found - 2))),
static_cast<std::uint16_t
>(std::stoi(str.substr(found + 1, str.size() - (found + 2)))));
241 else if(str[0] ==
'\033' && str[1] ==
'[' && str[2] ==
'<')
243 static std::chrono::time_point<std::chrono::system_clock> old;
244 bool not_too_long{
false};
245 if(std::chrono::system_clock::now() - old <= std::chrono::milliseconds{120}) not_too_long =
true;
246 m_Type = Type::Mouse;
249 std::vector<std::size_t> values;
250 while((pos = str.find(
';', pos)) != std::string::npos)
252 values.push_back(std::stoull(str.substr(pos2, pos - pos2)));
256 values.push_back(std::stoull(str.substr(pos2, str.size() - pos2 - 1)));
304 m_container.m_Mouse = first;
305 old = std::chrono::system_clock::now();
307 else if(str.size() <= 10)
327 if((str ==
"\u001bOA") || (str ==
"\u001b[A") || (str ==
"\u001bA")) { m_container.m_Key =
Key(
Term::Key::ArrowUp); }
328 else if((str ==
"\u001bOB") || (str ==
"\u001b[B") || (str ==
"\u001bB")) { m_container.m_Key =
Key(
Term::Key::ArrowDown); }
329 else if((str ==
"\u001bOC") || (str ==
"\u001b[C") || (str ==
"\u001bC")) { m_container.m_Key =
Key(
Term::Key::ArrowRight); }
330 else if((str ==
"\u001bOD") || (str ==
"\u001b[D") || (str ==
"\u001bD")) { m_container.m_Key =
Key(
Term::Key::ArrowLeft); }
338 else if((str ==
"\u001bOH") || (str ==
"\u001b[H"))
340 else if(str ==
"\u001bOF" || str ==
"\u001b[F")
363 else if(str ==
"\u001bOP" || str ==
"\u001b[11~")
365 else if(str ==
"\u001bOQ" || str ==
"\u001b[12~")
367 else if(str ==
"\u001bOR" || str ==
"\u001b[13~")
369 else if(str ==
"\u001bOS" || str ==
"\u001b[14~")
371 else if(str ==
"\u001b[15~")
373 else if(str ==
"\u001b[17~")
375 else if(str ==
"\u001b[18~")
377 else if(str ==
"\u001b[19~")
379 else if(str ==
"\u001b[20~")
381 else if(str ==
"\u001b[21~")
383 else if(str ==
"\u001b[23~")
385 else if(str ==
"\u001b[24~")
417 else if(str ==
"\u001b[25~")
419 else if(str ==
"\u001b[26~")
421 else if(str ==
"\u001b[28~")
423 else if(str ==
"\u001b[29~")
425 else if(str ==
"\u001b[31~")
427 else if(str ==
"\u001b[32~")
429 else if(str ==
"\u001b[33~")
431 else if(str ==
"\u001b[34~")
433 else if(str ==
"\u001b[G")
439 m_Type = Type::CopyPaste;
440 new(&this->m_container.m_string) std::string(str);
447 m_Type = Type::CopyPaste;
448 new(&this->m_container.m_string) std::string(str);