Skip to content

TerminalCell ​

Namespace: Hex1b

Assembly: Hex1b.dll

Represents a single cell in the virtual terminal screen buffer.

csharp
public readonly record struct TerminalCell : IEquatable<TerminalCell>

Implements ​

Constructors ​

TerminalCell(string, Hex1bColor?, Hex1bColor?, CellAttributes, long, DateTimeOffset, TrackedObject<HyperlinkData>?, Hex1bColor?, UnderlineStyle) ​

Represents a single cell in the virtual terminal screen buffer.

Parameters:

  • Character (String): The grapheme cluster (user-perceived character) displayed in this cell. May be multiple code points for emoji, combining characters, etc.
  • Foreground (Nullable<Hex1bColor>): The foreground color, or null for default.
  • Background (Nullable<Hex1bColor>): The background color, or null for default.
  • Attributes (CellAttributes): Text styling attributes (bold, italic, etc.).
  • Sequence (Int64): The write order of this cell. Higher values were written later. Used for z-ordering during rendering.
  • WrittenAt (DateTimeOffset): The timestamp when this cell was written. Useful for debugging and future animation features.
  • TrackedHyperlink (TrackedObject<HyperlinkData>): Optional tracked reference to hyperlink data associated with this cell.
  • UnderlineColor (Nullable<Hex1bColor>): The underline color (SGR 58), or null to use the foreground color.
  • UnderlineStyle (UnderlineStyle): The underline style (SGR 4:x). Defaults to .
csharp
public TerminalCell(string Character, Hex1bColor? Foreground, Hex1bColor? Background, CellAttributes Attributes = CellAttributes.None, long Sequence = 0, DateTimeOffset WrittenAt = default, TrackedObject<HyperlinkData>? TrackedHyperlink = null, Hex1bColor? UnderlineColor = null, UnderlineStyle UnderlineStyle = UnderlineStyle.None)

Properties ​

Attributes ​

Text styling attributes (bold, italic, etc.).

Returns: CellAttributes

csharp
public CellAttributes Attributes { get; init; }

Background ​

The background color, or null for default.

Returns: Nullable<Hex1bColor>

csharp
public Hex1bColor? Background { get; init; }

Character ​

The grapheme cluster (user-perceived character) displayed in this cell. May be multiple code points for emoji, combining characters, etc.

Returns: String

csharp
public string Character { get; init; }

Foreground ​

The foreground color, or null for default.

Returns: Nullable<Hex1bColor>

csharp
public Hex1bColor? Foreground { get; init; }

HasHyperlinkData ​

Gets whether this cell has associated hyperlink data.

Returns: Boolean

csharp
public bool HasHyperlinkData { get; }

HyperlinkData ​

Gets the hyperlink data if this cell has any, otherwise null.

Returns: HyperlinkData

csharp
public HyperlinkData? HyperlinkData { get; }

Gets whether this cell has blinking text.

Returns: Boolean

csharp
public bool IsBlink { get; }

IsBold ​

Gets whether this cell has bold text.

Returns: Boolean

csharp
public bool IsBold { get; }

IsDim ​

Gets whether this cell has dim/faint text.

Returns: Boolean

csharp
public bool IsDim { get; }

IsHidden ​

Gets whether this cell has hidden/invisible text.

Returns: Boolean

csharp
public bool IsHidden { get; }

IsItalic ​

Gets whether this cell has italic text.

Returns: Boolean

csharp
public bool IsItalic { get; }

IsOverline ​

Gets whether this cell has overlined text.

Returns: Boolean

csharp
public bool IsOverline { get; }

IsReverse ​

Gets whether this cell has reverse video (inverted colors).

Returns: Boolean

csharp
public bool IsReverse { get; }

IsSoftWrap ​

Gets whether this cell is a soft-wrap point (content continues on the next row).

Returns: Boolean

csharp
public bool IsSoftWrap { get; }

IsStrikethrough ​

Gets whether this cell has strikethrough text.

Returns: Boolean

csharp
public bool IsStrikethrough { get; }

IsUnderline ​

Gets whether this cell has underlined text.

Returns: Boolean

csharp
public bool IsUnderline { get; }

Sequence ​

The write order of this cell. Higher values were written later. Used for z-ordering during rendering.

Returns: Int64

csharp
public long Sequence { get; init; }

Optional tracked reference to hyperlink data associated with this cell.

Returns: TrackedObject<HyperlinkData>

csharp
public TrackedObject<HyperlinkData>? TrackedHyperlink { get; init; }

UnderlineColor ​

The underline color (SGR 58), or null to use the foreground color.

Returns: Nullable<Hex1bColor>

csharp
public Hex1bColor? UnderlineColor { get; init; }

UnderlineStyle ​

The underline style (SGR 4:x). Defaults to .

Returns: UnderlineStyle

csharp
public UnderlineStyle UnderlineStyle { get; init; }

WrittenAt ​

The timestamp when this cell was written. Useful for debugging and future animation features.

Returns: DateTimeOffset

csharp
public DateTimeOffset WrittenAt { get; init; }

Fields ​

Empty ​

An empty cell with default attributes.

Returns: TerminalCell

csharp
public static readonly TerminalCell Empty

Remarks ​

Sixel graphics are no longer owned by a cell. A cell that happens to sit under a Sixel placement carries no marker or reference at all; placement occupancy and image lifetime are tracked independently by the terminal's Sixel graphics state (see SixelGraphicsState) so overwriting a cell never has side effects on Sixel image lifetime.

Released under the MIT License.