ITextViewLine Interface
Provides the base requirements for a display line within an ITextView.
public interface ITextViewLine : ITextRangeProvider
Properties
Baseline
The distance from the top of the line to the baseline of the text.
BottomMargin
The margin length below the line's text bounds.
Bounds
The bounds of the line within the view, including any margin space.
Change
A TextViewLineChange that indicates the change made to the text represented by the line on the last layout pass.
CharacterCount
The number of characters that are displayed on the line, excluding any collapsed text ranges.
EndOffset
The offset at which the line ends, excluding any line terminator.
EndOffsetIncludingLineTerminator
The offset at which the line ends, including the line terminator if there is a hard line break on the line.
EndPosition
The TextPosition at which the line ends, excluding any line terminator.
EndPositionIncludingLineTerminator
The TextPosition at which the line ends, including the line terminator if there is a hard line break on the line.
FirstNonWhitespaceCharacterIndex
The index of the first non-whitespace character in the line.
FirstNonWhitespaceOffset
The offset of the first non-whitespace character in the line.
HasHardLineBreak
Indicates whether the the line ends with a line terminator.
bool HasHardLineBreak { get; }
Property Value
- bool:
trueif the the line ends with a line terminator; otherwise,false.
Remarks
This property will return false when there is a word-wrapped line following the line.
See Also
IndentAmount
The number of columns that the first non-whitespace character is indented on the line.
IsFirstLine
Indicates whether the line contains the first offset of the document.
bool IsFirstLine { get; }
Property Value
- bool:
trueif the line contains the first offset of the document; otherwise,false.
IsLastLine
Indicates whether the line contains the last offset of the document.
bool IsLastLine { get; }
Property Value
- bool:
trueif the line contains the last offset of the document; otherwise,false.
IsPureWhitespace
Indicates whether the line consists purely of whitespace characters.
bool IsPureWhitespace { get; }
Property Value
- bool:
trueif the line consists purely of whitespace characters; otherwise,false.
IsVirtualLine
Indicates whether the line is a virtual line, past the end of the document.
bool IsVirtualLine { get; }
Property Value
- bool:
trueif the line is a virtual line, past the end of the document; otherwise,false.
IsWrapped
Indicates whether the line is wrapped from the previous line.
bool IsWrapped { get; }
Property Value
- bool:
trueif the line is wrapped from the previous line; otherwise,false.
LineTerminator
The type of line terminator that ends the line, if any.
MaxPosition
The maximum TextPosition that can be displayed on the line.
NextLine
The ITextViewLine that is after this line.
PositionRange
The TextPositionRange that contains the line.
PreviousLine
The ITextViewLine that is before this line.
SavePointChangeType
A SavePointChangeType that indicates the type of change that has been made on the line relative to the save point.
Size
The Size of the line, including any margin space.
SnapshotRange
The TextSnapshotRange that indicates the snapshot range of the line.
SnapshotRangeIncludingLineTerminator
The TextSnapshotRange that indicates the snapshot range of the line, including the line terminator if there is a hard line break on the line.
StartOffset
The offset at which the line starts.
StartPosition
The TextPosition at which the line starts.
TabStopLevel
The tab stop level for the line.
Text
The text of the line, excluding the line terminator.
string Text { get; set; }
Property Value
Remarks
If more than one document line is encompassed on the view line, line terminators between the document view lines will be included.
TextBounds
The bounds of the line within the view, excluding any margin space.
TextRangeIncludingLineTerminator
The TextRange that indicates the text range of the line, including the line terminator if there is a hard line break on the line.
TextSize
The Size of the line, excluding any margin space.
TopMargin
The margin length above the line's text bounds.
TranslationY
The amount by which the line was translated if the Change was Translated.
View
The ITextView that this line is on.
Visibility
A TextViewLineVisibility that indicates the visibility state of the line.
VisibleSnapshotRanges
The collection of visible snapshot ranges on the line, including the line terminator if there is a hard line break on the line.
IEnumerable<TextSnapshotRange> VisibleSnapshotRanges { get; }
Property Value
VisibleStartPosition
The TextPosition of the first visible character or intra-text adornment on the line.
TextPosition VisibleStartPosition { get; }
Property Value
Remarks
This property may return a different value from StartPosition if there is collapsed text at the very start of the line without any intra-text adornment rendered in its place.
WordWrapIndex
The vertical index of the line as displayed for the related ITextSnapshotLine.
int WordWrapIndex { get; }
Property Value
Remarks
0 is returned if no word wrapping has occurred for the related ITextSnapshotLine at all.
0 is returned if there is word wrapping for the related ITextSnapshotLine, but this is the
first view line within that group.
1 is returned for the second view line within that group, and so on.
Methods
CharacterIndexToOffset(int)
Returns the offset for the specified character index within the line.
int CharacterIndexToOffset(int characterIndex)
| Parameter | Type | Description |
|---|---|---|
| characterIndex | int | The index of a character within the line. |
Returns
CharacterIndexToPosition(int)
Returns the TextPosition for the specified character index within the line.
TextPosition CharacterIndexToPosition(int characterIndex)
| Parameter | Type | Description |
|---|---|---|
| characterIndex | int | The index of a character within the line. |
Returns
GetCharacterBounds(TextPosition)
Returns the bounds for the specified TextPosition, relative to the text area's coordinates.
TextBounds? GetCharacterBounds(TextPosition position)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition whose bounds need to be retrieved. |
Returns
GetCharacterBounds(int)
Returns the bounds for the specified offset, relative to the text area's coordinates.
TextBounds? GetCharacterBounds(int offset)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset whose bounds need to be retrieved. |
Returns
GetCharacterColumn(TextPosition)
Returns the column index within the view for the specified character or 0 if the position is out of range.
int GetCharacterColumn(TextPosition position)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition of the character whose column index is being requested. |
Returns
GetCharacterColumn(int)
Returns the column index within the view for the specified character or 0 if the offset is out of range.
int GetCharacterColumn(int offset)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset of the character whose column index is being requested. |
Returns
GetIntraLineSpacerTags<TTag>()
Returns a collection of intra-line spacer tag ranges on the line that are of the type TTag.
IEnumerable<TagSnapshotRange<TTag>> GetIntraLineSpacerTags<TTag>() where TTag : IIntraLineSpacerTag
- Type Parameters:
-
TTag-The type of tag to look for.
Returns
- IEnumerable<TagSnapshotRange<TTag>>
GetIntraTextSpacerBounds(object)
Returns the bounds of the specified intra-text spacer.
TextBounds? GetIntraTextSpacerBounds(object tagKey)
| Parameter | Type | Description |
|---|---|---|
| tagKey | object | The object used to uniquely identify the intra-text spacer. |
Returns
GetIntraTextSpacerTag(int)
Returns the intra-text spacer tag range on the line at the specified character, if the character represents an intra-text spacer.
TagSnapshotRange<IIntraTextSpacerTag>? GetIntraTextSpacerTag(int characterIndex)
| Parameter | Type | Description |
|---|---|---|
| characterIndex | int | The index of the character to examine. |
Returns
Remarks
Spacer characters are embedded in between other real text characters. While spacer characters do take up a character index, they do not have a corresponding real character in a document.
GetIntraTextSpacerTags<TTag>()
Returns a collection of intra-text spacer tag ranges on the line that are of the type TTag.
IEnumerable<TagSnapshotRange<TTag>> GetIntraTextSpacerTags<TTag>() where TTag : IIntraTextSpacerTag
- Type Parameters:
-
TTag-The type of tag to look for.
Returns
- IEnumerable<TagSnapshotRange<TTag>>
GetTextBounds(TextPositionRange)
Returns the collection of bounds for the specified TextPositionRange of text.
IEnumerable<TextBounds> GetTextBounds(TextPositionRange positionRange)
| Parameter | Type | Description |
|---|---|---|
| positionRange | TextPositionRange | The TextPositionRange of the text for which to retrieve bounds. |
Returns
Remarks
This method typically only returns more than one TextBounds if there is bi-directional text in the text range.
GetTextBounds(TextRange)
Returns the collection of bounds for the specified TextRange of text.
IEnumerable<TextBounds> GetTextBounds(TextRange textRange)
| Parameter | Type | Description |
|---|---|---|
| textRange | TextRange | The TextRange of the text for which to retrieve bounds. |
Returns
Remarks
This method typically only returns more than one TextBounds if there is bi-directional text in the text range.
IsVirtualCharacter(int, bool)
Returns whether the character at the specified index is a virtual character.
bool IsVirtualCharacter(int characterIndex, bool lineTerminatorsAreVirtual)
| Parameter | Type | Description |
|---|---|---|
| characterIndex | int | The index of the character to examine. |
| lineTerminatorsAreVirtual | bool | Indicates whether to treat line terminators as virtual characters. |
Returns
- bool:
trueif the character at the specified index is a virtual character; otherwise,false.
LocationToCharacterIndex(int, LocationToPositionAlgorithm)
Returns the character index that contains the specified X location, in text area-relative coordinates.
int LocationToCharacterIndex(int x, LocationToPositionAlgorithm algorithm)
| Parameter | Type | Description |
|---|---|---|
| x | int | The x-coordinate for which to search. |
| algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
LocationToOffset(int, LocationToPositionAlgorithm)
Returns the offset that contains the specified X location, in text area-relative coordinates.
int LocationToOffset(int x, LocationToPositionAlgorithm algorithm)
| Parameter | Type | Description |
|---|---|---|
| x | int | The x-coordinate for which to search. |
| algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
LocationToPosition(int, LocationToPositionAlgorithm)
Returns the TextPosition that contains the specified X location, in text area-relative coordinates.
TextPosition? LocationToPosition(int x, LocationToPositionAlgorithm algorithm)
| Parameter | Type | Description |
|---|---|---|
| x | int | The x-coordinate for which to search. |
| algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
LocationToPosition(int, LocationToPositionAlgorithm, bool)
Returns the TextPosition that contains the specified X location, in text area-relative coordinates.
TextPosition? LocationToPosition(int x, LocationToPositionAlgorithm algorithm, bool forceVirtualSpace)
| Parameter | Type | Description |
|---|---|---|
| x | int | The x-coordinate for which to search. |
| algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
| forceVirtualSpace | bool | Whether to force virtual space to be used (for block selections). |
Returns
OffsetToCharacterIndex(int)
Returns the character index that represents the specified offset within the line.
int OffsetToCharacterIndex(int offset)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset of a character within the document. |
Returns
PositionToCharacterIndex(TextPosition)
Returns the character index that represents the specified TextPosition within the line.
int PositionToCharacterIndex(TextPosition position)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition of a character within the document. |