208{
210 else if(str.size() == 1)
211 {
214
216 }
217 else if(str == "\033[I")
218 {
221 }
222 else if(str == "\033[O")
223 {
226 }
227 else if(str.size() == 2 && str[0] == '\033')
228 {
231 }
232 else if(str[0] == '\033' && str[1] == '[' && str[str.size() - 1] == 'R')
233 {
234 std::size_t found = str.find(';', 2);
235 if(found != std::string::npos)
236 {
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)))));
239 }
240 }
241 else if(str[0] == '\033' && str[1] == '[' && str[2] == '<')
242 {
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;
247 std::size_t pos{3};
248 std::size_t pos2{3};
249 std::vector<std::size_t> values;
250 while((pos = str.find(';', pos)) != std::string::npos)
251 {
252 values.push_back(std::stoull(str.substr(pos2, pos - pos2)));
253 pos++;
254 pos2 = pos;
255 }
256 values.push_back(std::stoull(str.substr(pos2, str.size() - pos2 - 1)));
261 else
264 switch(values[0])
265 {
266 case 0:
267 {
269 break;
270 }
271 case 1:
272 {
274 break;
275 }
276 case 2:
277 {
279 break;
280 }
281 case 35:
282 {
285 break;
286 }
287 case 64:
288 {
291 break;
292 }
293 case 65:
294 {
297 break;
298 }
299 default: break;
300 }
302 second = first;
305 old = std::chrono::system_clock::now();
306 }
307 else if(str.size() <= 10)
308 {
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
331
332
333
334
335
336
337
338 else if((str == "\u001bOH") || (str == "\u001b[H"))
340 else if(str == "\u001bOF" || str == "\u001b[F")
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
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~")
387
388
389
390
391
392
393
394
395
396
397
404
405
406
407
408
409
410
411
412
413
414
415
416
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")
437 else
438 {
441 return;
442 }
444 }
445 else
446 {
449 }
450}
Class to return the focus of the terminal.
@ Out
The terminal focus is out.
@ In
The terminal focus is in.
std::size_t row() const noexcept
std::size_t column() const noexcept
Term::Button getButton() const noexcept
std::u32string utf8_to_utf32(const std::string &str)
bool is_valid_utf8_code_unit(const std::string &str)