Class EscSeqUtils
Provides a platform-independent API for managing ANSI escape sequence codes.
Inheritance
System.Object
EscSeqUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public static class EscSeqUtils
Fields
| Improve this Doc View SourceCSI_DisableAnyEventMouse
Represents the CSI for disable any mouse event tracking.
Declaration
public static readonly string CSI_DisableAnyEventMouse
Field Value
Type | Description |
---|---|
System.String |
CSI_DisableSgrExtModeMouse
Represents the CSI for disable SGR (Select Graphic Rendition).
Declaration
public static readonly string CSI_DisableSgrExtModeMouse
Field Value
Type | Description |
---|---|
System.String |
CSI_DisableUrxvtExtModeMouse
Represents the CSI for disable URXVT (Unicode Extended Virtual Terminal).
Declaration
public static readonly string CSI_DisableUrxvtExtModeMouse
Field Value
Type | Description |
---|---|
System.String |
CSI_EnableAnyEventMouse
Represents the CSI for enable any mouse event tracking.
Declaration
public static readonly string CSI_EnableAnyEventMouse
Field Value
Type | Description |
---|---|
System.String |
CSI_EnableSgrExtModeMouse
Represents the CSI for enable SGR (Select Graphic Rendition).
Declaration
public static readonly string CSI_EnableSgrExtModeMouse
Field Value
Type | Description |
---|---|
System.String |
CSI_EnableUrxvtExtModeMouse
Represents the CSI for enable URXVT (Unicode Extended Virtual Terminal).
Declaration
public static readonly string CSI_EnableUrxvtExtModeMouse
Field Value
Type | Description |
---|---|
System.String |
KeyCSI
Represents the CSI (Control Sequence Introducer).
Declaration
public static readonly string KeyCSI
Field Value
Type | Description |
---|---|
System.String |
KeyEsc
Represents the escape key.
Declaration
public static readonly char KeyEsc
Field Value
Type | Description |
---|---|
System.Char |
Properties
| Improve this Doc View SourceDisableMouseEvents
Control sequence for disable mouse events.
Declaration
public static string DisableMouseEvents { get; set; }
Property Value
Type | Description |
---|---|
System.String |
EnableMouseEvents
Control sequence for enable mouse events.
Declaration
public static string EnableMouseEvents { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceDecodeEscSeq(EscSeqReqProc, ref ConsoleKeyInfo, ref ConsoleKey, ConsoleKeyInfo[], ref ConsoleModifiers, out String, out String, out String[], out String, out Boolean, out List<MouseFlags>, out Point, out Boolean, Action<MouseFlags, Point>)
Decodes a escape sequence to been processed in the appropriate manner.
Declaration
public static void DecodeEscSeq(EscSeqReqProc escSeqReqProc, ref ConsoleKeyInfo newConsoleKeyInfo, ref ConsoleKey key, ConsoleKeyInfo[] cki, ref ConsoleModifiers mod, out string c1Control, out string code, out string[] values, out string terminating, out bool isKeyMouse, out List<MouseFlags> buttonState, out Point pos, out bool isReq, Action<MouseFlags, Point> continuousButtonPressedHandler)
Parameters
Type | Name | Description |
---|---|---|
EscSeqReqProc | escSeqReqProc | The EscSeqReqProc which may contain a request. |
System.ConsoleKeyInfo | newConsoleKeyInfo | The System.ConsoleKeyInfo which may changes. |
System.ConsoleKey | key | The System.ConsoleKey which may changes. |
System.ConsoleKeyInfo[] | cki | The System.ConsoleKeyInfo array. |
System.ConsoleModifiers | mod | The System.ConsoleModifiers which may changes. |
System.String | c1Control | The control returned by the GetC1ControlChar(Char) method. |
System.String | code | The code returned by the GetEscapeResult(Char[]) method. |
System.String[] | values | The values returned by the GetEscapeResult(Char[]) method. |
System.String | terminating | The terminating returned by the GetEscapeResult(Char[]) method. |
System.Boolean | isKeyMouse | Indicates if the escape sequence is a mouse key. |
System.Collections.Generic.List<MouseFlags> | buttonState | The MouseFlags button state. |
Point | pos | The MouseFlags position. |
System.Boolean | isReq | Indicates if the escape sequence is a response to a request. |
System.Action<MouseFlags, Point> | continuousButtonPressedHandler | The handler that will process the event. |
GetC1ControlChar(Char)
Gets the c1Control used in the called escape sequence.
Declaration
public static string GetC1ControlChar(char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The char used. |
Returns
Type | Description |
---|---|
System.String | The c1Control. |
GetConsoleInputKey(ConsoleKeyInfo)
Ensures a console key is mapped to one that works correctly with ANSI escape sequences.
Declaration
public static ConsoleKeyInfo GetConsoleInputKey(ConsoleKeyInfo consoleKeyInfo)
Parameters
Type | Name | Description |
---|---|---|
System.ConsoleKeyInfo | consoleKeyInfo | The System.ConsoleKeyInfo. |
Returns
Type | Description |
---|---|
System.ConsoleKeyInfo | The System.ConsoleKeyInfo modified. |
GetConsoleKey(Char, String, ref ConsoleModifiers)
Gets the System.ConsoleKey depending on terminating and value.
Declaration
public static ConsoleKey GetConsoleKey(char terminating, string value, ref ConsoleModifiers mod)
Parameters
Type | Name | Description |
---|---|---|
System.Char | terminating | The terminating. |
System.String | value | The value. |
System.ConsoleModifiers | mod | The System.ConsoleModifiers which may changes. |
Returns
Type | Description |
---|---|
System.ConsoleKey | The System.ConsoleKey and probably the System.ConsoleModifiers. |
GetConsoleModifiers(String)
Gets the System.ConsoleModifiers from the value.
Declaration
public static ConsoleModifiers GetConsoleModifiers(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Returns
Type | Description |
---|---|
System.ConsoleModifiers | The System.ConsoleModifiers or zero. |
GetEscapeResult(Char[])
Gets all the needed information about a escape sequence.
Declaration
public static (string c1Control, string code, string[] values, string terminating) GetEscapeResult(char[] kChar)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | kChar | The array with all chars. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.String, System.String, System.String[], System.String> | The c1Control returned by GetC1ControlChar(Char), code, values and terminating. |
GetKeyCharArray(ConsoleKeyInfo[])
A helper to get only the System.ConsoleKeyInfo.KeyChar from the System.ConsoleKeyInfo array.
Declaration
public static char[] GetKeyCharArray(ConsoleKeyInfo[] cki)
Parameters
Type | Name | Description |
---|---|---|
System.ConsoleKeyInfo[] | cki |
Returns
Type | Description |
---|---|
System.Char[] | The char array of the escape sequence. |
GetMouse(ConsoleKeyInfo[], out List<MouseFlags>, out Point, Action<MouseFlags, Point>)
Gets the MouseFlags mouse button flags and the position.
Declaration
public static void GetMouse(ConsoleKeyInfo[] cki, out List<MouseFlags> mouseFlags, out Point pos, Action<MouseFlags, Point> continuousButtonPressedHandler)
Parameters
Type | Name | Description |
---|---|---|
System.ConsoleKeyInfo[] | cki | The System.ConsoleKeyInfo array. |
System.Collections.Generic.List<MouseFlags> | mouseFlags | The mouse button flags. |
Point | pos | The mouse position. |
System.Action<MouseFlags, Point> | continuousButtonPressedHandler | The handler that will process the event. |
GetParentProcess(Process)
Get the terminal that holds the console driver.
Declaration
public static Process GetParentProcess(Process process)
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.Process | process | The process. |
Returns
Type | Description |
---|---|
System.Diagnostics.Process | If supported the executable console process, null otherwise. |
ResizeArray(ConsoleKeyInfo, ConsoleKeyInfo[])
A helper to resize the System.ConsoleKeyInfo as needed.
Declaration
public static ConsoleKeyInfo[] ResizeArray(ConsoleKeyInfo consoleKeyInfo, ConsoleKeyInfo[] cki)
Parameters
Type | Name | Description |
---|---|---|
System.ConsoleKeyInfo | consoleKeyInfo | The System.ConsoleKeyInfo. |
System.ConsoleKeyInfo[] | cki | The System.ConsoleKeyInfo array to resize. |
Returns
Type | Description |
---|---|
System.ConsoleKeyInfo[] | The System.ConsoleKeyInfo resized. |