namespace Terminal.Gui.Drivers; /// /// capable of converting the /// unix native class /// into Terminal.Gui shared representation /// (used by etc). /// internal class UnixKeyConverter : IKeyConverter { /// public Key ToKey (char value) { ConsoleKeyInfo adjustedInput = EscSeqUtils.MapChar (value); return EscSeqUtils.MapKey (adjustedInput); } /// public char ToKeyInfo (Key key) { // Convert Key to ConsoleKeyInfo using the cross-platform mapping utility ConsoleKeyInfo consoleKeyInfo = ConsoleKeyMapping.GetConsoleKeyInfoFromKeyCode (key.KeyCode); // Return the character representation // For Unix, we primarily care about the KeyChar as Unix deals with character input return consoleKeyInfo.KeyChar; } }