OscToken
Namespace: Hex1b.Tokens
Assembly: Hex1b.dll
Represents an Operating System Command (OSC): ESC ] command ; params ; payload ST
public sealed record OscToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<OscToken>Inheritance
Implements
Constructors
OscToken(string, string, string, bool)
Represents an Operating System Command (OSC): ESC ] command ; params ; payload ST
Parameters:
Command(String): The OSC command number as a string (e.g., "8" for hyperlinks).Parameters(String): Optional parameters between command and payload. Empty for title commands.Payload(String): The main payload (e.g., URL for OSC 8 or title text for OSC 0/1/2). Semicolons in title text are part of the payload.UseEscBackslash(Boolean): If true, use ESC \ as terminator instead of BEL.
public OscToken(string Command, string Parameters, string Payload, bool UseEscBackslash = false)Properties
Command
The OSC command number as a string (e.g., "8" for hyperlinks).
Returns: String
public string Command { get; init; }Parameters
Optional parameters between command and payload. Empty for title commands.
Returns: String
public string Parameters { get; init; }Payload
The main payload (e.g., URL for OSC 8 or title text for OSC 0/1/2). Semicolons in title text are part of the payload.
Returns: String
public string Payload { get; init; }UseEscBackslash
If true, use ESC \ as terminator instead of BEL.
Returns: Boolean
public bool UseEscBackslash { get; init; }Remarks
Common OSC commands: 0 = Set window title and icon name1 = Set icon name2 = Set window title8 = Hyperlink: ESC ] 8 ; params ; URI ST
The string terminator (ST) can be ESC \ or BEL (\x07).
Normalization: This token type normalizes the original encoding. The tokenizer accepts both 7-bit (ESC ]) and C1 (0x9D) start sequences, and BEL, ESC , or 0x9C terminators. When serialized, the token always uses 7-bit encoding with BEL terminator for maximum compatibility. If byte-level fidelity is needed for recording/proxying, consider adding optional fields to preserve the original encoding.