UnixKeyConverter.cs 548 B

1234567891011121314151617181920
  1. #nullable enable
  2. namespace Terminal.Gui.Drivers;
  3. /// <summary>
  4. /// <see cref="IKeyConverter{T}"/> capable of converting the
  5. /// unix native <see cref="char"/> class
  6. /// into Terminal.Gui shared <see cref="Key"/> representation
  7. /// (used by <see cref="View"/> etc).
  8. /// </summary>
  9. internal class UnixKeyConverter : IKeyConverter<char>
  10. {
  11. /// <inheritdoc />
  12. public Key ToKey (char value)
  13. {
  14. ConsoleKeyInfo adjustedInput = EscSeqUtils.MapChar (value);
  15. return EscSeqUtils.MapKey (adjustedInput);
  16. }
  17. }