VtKeyReader
An IReplKeyReader that reads from a TextReader and parses VT/ANSI escape sequences into ConsoleKeyInfo values. Used for server-side line editing over remote transports (WebSocket, SignalR, etc.).
- Kind:
Class - Namespace: Repl
- Assembly:
Repl.Defaults - Source: src/Repl.Defaults/VtKeyReader.cs
Signature
Section titled “Signature”public sealed class VtKeyReader : IReplKeyReaderInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Constructors
Section titled “Constructors”VtKeyReader(TextReader)
Section titled “VtKeyReader(TextReader)”Initializes a new instance of the VtKeyReader class.
public VtKeyReader(TextReader reader)Parameters
Section titled “Parameters”reader(TextReader): Underlying character reader (typically a ChannelTextReader).
Methods
Section titled “Methods”ReadKeyAsync(CancellationToken)
Section titled “ReadKeyAsync(CancellationToken)”Reads the next key press. Blocks until a key is available or token is cancelled.
public ValueTask<ConsoleKeyInfo> ReadKeyAsync(CancellationToken ct)Parameters
Section titled “Parameters”ct(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<ConsoleKeyInfo> - The key info of the pressed key.
Properties
Section titled “Properties”KeyAvailable
Section titled “KeyAvailable”Returns true if a key is available to read without blocking.
public bool KeyAvailable { get; }Returns
Section titled “Returns”OnResize
Section titled “OnResize”Optional callback invoked when a DTTERM window size report is received. Parameters are (cols, rows).
public Action<int, int>? OnResize { get; set; }Returns
Section titled “Returns”Action<int, int>