Skip to content

SaveCursorToken ​

Namespace: Hex1b.Tokens

Assembly: Hex1b.dll

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

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

Inheritance ​

Object → AnsiToken → SaveCursorToken

Implements ​

Constructors ​

SaveCursorToken(bool) ​

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

Parameters:

  • UseDec (Boolean): If true, use DEC format (ESC 7) which also saves character attributes. If false, use ANSI.SYS format (ESC [ s) which only saves cursor position.
csharp
public SaveCursorToken(bool UseDec = true)

Properties ​

UseDec ​

If true, use DEC format (ESC 7) which also saves character attributes. If false, use ANSI.SYS format (ESC [ s) which only saves cursor position.

Returns: Boolean

csharp
public bool UseDec { get; init; }

Fields ​

Ansi ​

Save cursor using ANSI.SYS format (ESC [ s) - saves position only.

Returns: SaveCursorToken

csharp
public static readonly SaveCursorToken Ansi

Dec ​

Save cursor using DEC format (ESC 7) - saves position and attributes.

Returns: SaveCursorToken

csharp
public static readonly SaveCursorToken Dec

Remarks ​

Saves the current cursor position (and optionally attributes) for later restoration with .

The DEC format (ESC 7) is more widely supported and also saves: Cursor positionCharacter attributes (SGR)Character setOrigin mode state

Released under the MIT License.