Segment Class

Represents a renderable segment.
[DebuggerDisplay("{Text,nq}")]
public class Segment

Attributes

DebuggerDisplayAttribute

Constructors

Segment(string, Style)
Initializes a new instance of the Segment class.
Segment(string)
Initializes a new instance of the Segment class.

Properties

static Segment Empty
Gets an empty segment.
bool IsControlCode
Gets a value indicating whether or not his is a control code such as cursor movement.
bool IsLineBreak
Gets a value indicating whether or not this is an explicit line break that should be preserved.
bool IsWhiteSpace
Gets a value indicating whether or not this is a whitespace that should be preserved but not taken into account when layouting text.
static Segment LineBreak
Gets a segment representing a line break.
Style Style
Gets the segment style.
string Text
Gets the segment text.

Methods

int CellCount()
Gets the number of cells that this segment occupies in the console.
static int CellCount(IEnumerable<Segment>)
Gets the number of cells that the segments occupies in the console.
Segment Clone()
Clones the segment.
static Segment Control(string)
Creates a control segment.
static Segment Padding(int)
Creates padding segment.
(Segment First, Segment Second) Split(int)
Splits the segment at the offset.
static List<SegmentLine> SplitLines(IEnumerable<Segment>, int, int?)
Splits the provided segments into lines with a maximum width.
static List<SegmentLine> SplitLines(IEnumerable<Segment>)
Splits the provided segments into lines.
static List<Segment> SplitOverflow(Segment, Overflow?, int)
Splits an overflowing segment into several new segments.
Segment StripLineEndings()
Returns a new segment without any trailing line endings.
static List<Segment> Truncate(IEnumerable<Segment>, int)
Truncates the segments to the specified width.
static Segment Truncate(Segment, int)
Truncates the segment to the specified width.