Segment
Defined in: src/render/segment.ts:130
A run of text sharing one Style — the unit drawn by ScreenBuffer.drawSegment.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Segment(
text,style?):Segment
Defined in: src/render/segment.ts:131
Parameters
Section titled “Parameters”string
The run’s text.
style?
Section titled “style?”Style = Style.DEFAULT
The run’s style.
Returns
Section titled “Returns”Segment
Properties
Section titled “Properties”
readonlystyle:Style=Style.DEFAULT
Defined in: src/render/segment.ts:135
The run’s style.
readonlytext:string
Defined in: src/render/segment.ts:133
The run’s text.
Accessors
Section titled “Accessors”cellLength
Section titled “cellLength”Get Signature
Section titled “Get Signature”get cellLength():
number
Defined in: src/render/segment.ts:139
Display width of the text in cells (grapheme-aware).
Returns
Section titled “Returns”number
Methods
Section titled “Methods”crop()
Section titled “crop()”crop(
startCell,endCell):Segment
Defined in: src/render/segment.ts:144
Crop to the cell range [startCell, endCell), padding wide glyphs that straddle the edge with a space.
Parameters
Section titled “Parameters”startCell
Section titled “startCell”number
endCell
Section titled “endCell”number
Returns
Section titled “Returns”Segment