AnsiResponseParser.cs 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. class AnsiResponseParser
  4. {
  5. /*
  6. * ANSI Input Sequences
  7. *
  8. * \x1B[A // Up Arrow key pressed
  9. * \x1B[B // Down Arrow key pressed
  10. * \x1B[C // Right Arrow key pressed
  11. * \x1B[D // Left Arrow key pressed
  12. * \x1B[3~ // Delete key pressed
  13. * \x1B[2~ // Insert key pressed
  14. * \x1B[5~ // Page Up key pressed
  15. * \x1B[6~ // Page Down key pressed
  16. * \x1B[1;5D // Ctrl + Left Arrow
  17. * \x1B[1;5C // Ctrl + Right Arrow
  18. * \x1B[0;10;20M // Mouse button pressed at position (10, 20)
  19. * \x1B[0c // Device Attributes Response (e.g., terminal identification)
  20. */
  21. private bool inResponse = false;
  22. public bool ConsumeInput (char character, out string? released)
  23. {
  24. // if character is escape
  25. // start consuming till we see terminator
  26. released = null;
  27. return false;
  28. }
  29. public void ExpectResponse (char terminator, Action<string> response)
  30. {
  31. }
  32. }