mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-02-10 04:13:32 +01:00
* Update packages * Convert extension methods to extension blocks * Move extension methods closer to what they are extending * Use ArgumentNullException.ThrowIfNull * Move WriteAnsi and ToAnsi methods to Spectre.Console namespace * Make shared global state obsolete * Make AnsiConsole.Clear an extension method * Linting should not fail build
18 lines
382 B
C#
18 lines
382 B
C#
namespace Spectre.Console.Tests;
|
|
|
|
public static class ConsoleKeyExtensions
|
|
{
|
|
extension(ConsoleKey key)
|
|
{
|
|
public ConsoleKeyInfo ToConsoleKeyInfo()
|
|
{
|
|
var ch = (char)key;
|
|
if (char.IsControl(ch))
|
|
{
|
|
ch = '\0';
|
|
}
|
|
|
|
return new ConsoleKeyInfo(ch, key, false, false, false);
|
|
}
|
|
}
|
|
} |