#nullable enable namespace Terminal.Gui; /// /// Describes an ongoing ANSI request sent to the console. /// Use to handle the response /// when console answers the request. /// public class AnsiEscapeSequenceRequest { /// /// Request to send e.g. see /// /// EscSeqUtils.CSI_SendDeviceAttributes.Request /// /// public required string Request { get; init; } /// /// Invoked when the console responds with an ANSI response code that matches the /// /// public Action ResponseReceived; /// /// /// The terminator that uniquely identifies the type of response as responded /// by the console. e.g. for /// /// EscSeqUtils.CSI_SendDeviceAttributes.Request /// /// the terminator is /// /// EscSeqUtils.CSI_SendDeviceAttributes.Terminator /// /// . /// /// /// After sending a request, the first response with matching terminator will be matched /// to the oldest outstanding request. /// /// public required string Terminator { get; init; } /// /// Sends the to the raw output stream of the current . /// Only call this method from the main UI thread. You should use if /// sending many requests. /// public void Send () { Application.Driver?.RawWrite (Request); } /// /// The value expected in the response e.g. /// /// EscSeqUtils.CSI_ReportTerminalSizeInChars.Value /// /// which will have a 't' as terminator but also other different request may return the same terminator with a /// different value. /// public string? Value { get; init; } }