namespace Terminal.Gui;
///
/// capable of converting the
/// dotnet class into Terminal.Gui
/// shared representation (used by
/// etc).
///
internal class NetKeyConverter : IKeyConverter
{
///
public Key ToKey (ConsoleKeyInfo input)
{
ConsoleKeyInfo adjustedInput = EscSeqUtils.MapConsoleKeyInfo (input);
// TODO : EscSeqUtils.MapConsoleKeyInfo is wrong for e.g. '{' - it winds up clearing the Key
// So if the method nuked it then we should just work with the original.
if (adjustedInput.Key == ConsoleKey.None && input.Key != ConsoleKey.None)
{
return EscSeqUtils.MapKey (input);
}
return EscSeqUtils.MapKey (adjustedInput);
}
}