Skip to content

Hex1b.Tokens ​

Assembly: Hex1b.dll

Classes ​

AnsiToken ​

Base type for all ANSI terminal tokens.

csharp
public abstract record AnsiToken : IEquatable<AnsiToken>

AnsiTokenizer ​

Parses ANSI text into a list of tokens.

csharp
public static class AnsiTokenizer

AnsiTokenSerializer ​

Serializes ANSI tokens back into escape sequence strings.

csharp
public static class AnsiTokenSerializer

AnsiTokenUtf8Serializer ​

Serializes ANSI tokens directly to UTF-8 bytes to avoid allocating intermediate strings.

csharp
public static class AnsiTokenUtf8Serializer

AppliedToken ​

Represents a token that has been applied to the terminal buffer, bundled with metadata about what changed.

csharp
public record AppliedToken : IEquatable<AppliedToken>

ArrowKeyToken ​

Represents an arrow key input with optional modifiers.

csharp
public sealed record ArrowKeyToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ArrowKeyToken>

BackTabToken ​

Represents a Backtab (Shift+Tab) escape sequence (CSI Z).

csharp
public sealed record BackTabToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<BackTabToken>

CharacterSetToken ​

Represents a character set designation sequence: ESC ( X or ESC ) X These sequences select which character set to use for the G0 or G1 character set.

csharp
public sealed record CharacterSetToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<CharacterSetToken>

ClearLineToken ​

Represents a CSI Erase in Line command (EL): ESC [ mode K or Selective Erase in Line (DECSEL): ESC [ ? mode K

csharp
public sealed record ClearLineToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ClearLineToken>

ClearScreenToken ​

Represents a CSI Erase in Display command (ED): ESC [ mode J or Selective Erase in Display (DECSED): ESC [ ? mode J

csharp
public sealed record ClearScreenToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ClearScreenToken>

ControlCharacterToken ​

Represents a control character (CR, LF, TAB, etc.).

csharp
public sealed record ControlCharacterToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ControlCharacterToken>

CursorColumnToken ​

Represents a CSI Cursor Horizontal Absolute (CHA) command: ESC [ n G

csharp
public sealed record CursorColumnToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<CursorColumnToken>

CursorMoveToken ​

Represents a CSI cursor movement command.

csharp
public sealed record CursorMoveToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<CursorMoveToken>

CursorPositionToken ​

Represents a CSI cursor position command (CUP): ESC [ row ; col H

csharp
public sealed record CursorPositionToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<CursorPositionToken>

CursorRowToken ​

Represents a CSI Vertical Position Absolute (VPA) command: ESC [ n d

csharp
public sealed record CursorRowToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<CursorRowToken>

CursorShapeToken ​

Represents a CSI cursor shape command (DECSCUSR): ESC [ n SP q

csharp
public sealed record CursorShapeToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<CursorShapeToken>

DcsToken ​

Represents a Device Control String (DCS): ESC P ... ST

csharp
public sealed record DcsToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DcsToken>

DecalnToken ​

Represents the DECALN (DEC Screen Alignment Test) escape sequence: ESC # 8. Fills the entire screen with 'E' characters and resets margins.

csharp
public sealed record DecalnToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DecalnToken>

DecscaToken ​

Token for DECSCA (Select Character Protection Attribute): CSI Ps " q

csharp
public sealed record DecscaToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DecscaToken>

DeleteCharacterToken ​

Represents a CSI Delete Character (DCH) command: ESC [ n P Deletes n characters at cursor, shifting remaining characters left.

csharp
public sealed record DeleteCharacterToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DeleteCharacterToken>

DeleteColumnsToken ​

Represents DECDC column deletion.

csharp
public sealed record DeleteColumnsToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DeleteColumnsToken>

DeleteLinesToken ​

Represents a CSI Delete Line (DL) command: ESC [ n M Deletes n lines at the cursor position, pulling lines up from below.

csharp
public sealed record DeleteLinesToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DeleteLinesToken>

DeviceAttributesQueryToken ​

Represents a Primary Device Attributes (DA1) request: CSI c or CSI 0 c.

csharp
public sealed record DeviceAttributesQueryToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DeviceAttributesQueryToken>

DeviceStatusReportToken ​

Represents a Device Status Report (DSR) request. ESC [ Ps n where Ps is the type of report requested. Common values:

  • 5: Status report (terminal responds ESC [ 0 n for "ready")
  • 6: Cursor position report (terminal responds ESC [ row ; col R)
csharp
public record DeviceStatusReportToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<DeviceStatusReportToken>

EraseCharacterToken ​

Represents a CSI Erase Character (ECH) command: ESC [ n X Erases n characters from cursor without moving cursor or shifting.

csharp
public sealed record EraseCharacterToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<EraseCharacterToken>

IndexToken ​

Represents an Index (IND) command: ESC D Moves the cursor down one line, scrolling if at the bottom margin.

csharp
public sealed record IndexToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<IndexToken>

InsertCharacterToken ​

Represents a CSI Insert Character (ICH) command: ESC [ n @ Inserts n blank characters at cursor, shifting existing characters right.

csharp
public sealed record InsertCharacterToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<InsertCharacterToken>

InsertColumnsToken ​

Represents DECIC or DECDC column editing.

csharp
public sealed record InsertColumnsToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<InsertColumnsToken>

InsertLinesToken ​

Represents a CSI Insert Line (IL) command: ESC [ n L Inserts n blank lines at the cursor position, pushing existing lines down.

csharp
public sealed record InsertLinesToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<InsertLinesToken>

KeypadModeToken ​

Represents an Application Keypad Mode sequence: ESC = Switches the keypad to application mode.

csharp
public sealed record KeypadModeToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<KeypadModeToken>

KgpToken ​

Represents a Kitty Graphics Protocol (KGP) command: ESC _G ... ST

csharp
public sealed record KgpToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<KgpToken>

LeftRightMarginToken ​

Represents a CSI Set Left Right Margins (DECSLRM) command: ESC [ left ; right s Sets the left and right margins for the scrolling region. Only active when DECLRMM (mode 69) is enabled.

csharp
public sealed record LeftRightMarginToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<LeftRightMarginToken>

OscToken ​

Represents an Operating System Command (OSC): ESC ] command ; params ; payload ST

csharp
public sealed record OscToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<OscToken>

PrivateModeToken ​

Represents a CSI private mode set/reset command: ESC [ ? mode h/l

csharp
public sealed record PrivateModeToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<PrivateModeToken>

RectangularEraseToken ​

Represents DECERA or DECSERA rectangular erase.

csharp
public sealed record RectangularEraseToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<RectangularEraseToken>

RepeatCharacterToken ​

Represents a CSI Repeat (REP) command: ESC [ n b Repeats the previous graphic character n times.

csharp
public sealed record RepeatCharacterToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<RepeatCharacterToken>

RestoreCursorToken ​

Represents a cursor restore command: ESC 8 (DECRC) or ESC [ u (ANSI.SYS)

csharp
public sealed record RestoreCursorToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<RestoreCursorToken>

ReverseIndexToken ​

Represents a Reverse Index (RI) command: ESC M Moves the cursor up one line, scrolling if at the top margin.

csharp
public sealed record ReverseIndexToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ReverseIndexToken>

RisToken ​

Token for RIS (Reset to Initial State, ESC c) — full terminal reset.

csharp
public sealed record RisToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<RisToken>

SaveCursorToken ​

Represents a cursor save command: ESC 7 (DECSC) or ESC [ s (ANSI.SYS)

csharp
public sealed record SaveCursorToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SaveCursorToken>

ScrollDownToken ​

Represents a CSI Scroll Down (SD) command: ESC [ n T Scrolls the content down by n lines, inserting blank lines at the top.

csharp
public sealed record ScrollDownToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ScrollDownToken>

ScrollRegionToken ​

Represents a CSI Set Scrolling Region command (DECSTBM): ESC [ top ; bottom r

csharp
public sealed record ScrollRegionToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ScrollRegionToken>

ScrollUpToken ​

Represents a CSI Scroll Up (SU) command: ESC [ n S Scrolls the content up by n lines, inserting blank lines at the bottom.

csharp
public sealed record ScrollUpToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<ScrollUpToken>

SgrMouseToken ​

Represents an SGR (1006) mouse protocol sequence. Format: ESC [ < Cb ; Cx ; Cy M (press) or ESC [ < Cb ; Cx ; Cy m (release)

csharp
public sealed record SgrMouseToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SgrMouseToken>

SgrToken ​

Represents a CSI Select Graphic Rendition command (SGR): ESC [ params m

csharp
public sealed record SgrToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SgrToken>

SoftResetToken ​

Token for DECSTR (Soft Terminal Reset, CSI ! p).

csharp
public sealed record SoftResetToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SoftResetToken>

SpecialKeyToken ​

Represents a function key or special key sequence in the format ESC [ n ~.

csharp
public sealed record SpecialKeyToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<SpecialKeyToken>

Ss3Token ​

Represents an SS3 (Single Shift 3) escape sequence (ESC O followed by a character). SS3 sequences are used for function keys F1-F4 and arrow keys in application keypad mode.

csharp
public sealed record Ss3Token : AnsiToken, IEquatable<AnsiToken>, IEquatable<Ss3Token>

StandardModeToken ​

Represents a CSI standard (non-private) mode set/reset command: ESC [ mode h/l

csharp
public sealed record StandardModeToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<StandardModeToken>

TabClearToken ​

Represents a Tab Clear (TBC) sequence: CSI Ps g

csharp
public sealed record TabClearToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<TabClearToken>

TextToken ​

Represents plain text content to be written at the current cursor position.

csharp
public sealed record TextToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<TextToken>

UnrecognizedSequenceToken ​

Represents an unrecognized or unsupported escape sequence.

csharp
public sealed record UnrecognizedSequenceToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<UnrecognizedSequenceToken>

WindowOperationToken ​

Represents an XTWINOPS window operation request: CSI Ps t.

csharp
public sealed record WindowOperationToken : AnsiToken, IEquatable<AnsiToken>, IEquatable<WindowOperationToken>

Structs ​

CellImpact ​

Captures a cell that was modified during token application.

csharp
public readonly record struct CellImpact : IEquatable<CellImpact>

TerminalGraphicsImpact ​

Captures a terminal graphics placement or damage region.

csharp
public readonly record struct TerminalGraphicsImpact : IEquatable<TerminalGraphicsImpact>

Enums ​

ClearMode ​

The mode for CSI clear screen (ED) and clear line (EL) commands.

csharp
public enum ClearMode

CursorMoveDirection ​

Direction for relative cursor movement.

csharp
public enum CursorMoveDirection

TerminalGraphicsImpactKind ​

Identifies a terminal graphics state change reported to presentation adapters.

csharp
public enum TerminalGraphicsImpactKind

Released under the MIT License.