ITextViewLine Interface
Provides the base requirements for a display line within an ITextView.
public interface ITextViewLine : ITextRangeProvider
Properties
Baseline
Gets the distance from the top of the line to the baseline of the text.
double Baseline { get; }
Property Value
- System.Double:
The distance from the top of the line to the baseline of the text.
BottomMargin
Gets the margin length below the line's text bounds.
double BottomMargin { get; }
Property Value
- System.Double:
The margin length below the line's text bounds.
Bounds
Gets the bounds of the line within the view, including any margin space.
Rect Bounds { get; }
Property Value
- System.Windows.Rect:
The bounds of the line within the view, including any margin space.
Change
Gets a TextViewLineChange that indicates the change made to the text represented by the line on the last layout pass.
TextViewLineChange Change { get; }
Property Value
- TextViewLineChange:
A TextViewLineChange that indicates the change made to the text represented by the line on the last layout pass.
CharacterCount
Gets the number of characters that are displayed on the line, excluding any collapsed text ranges.
int CharacterCount { get; }
Property Value
- System.Int32:
The number of characters that are displayed on the line, excluding any collapsed text ranges.
EndOffset
Gets the offset at which the line ends, excluding any line terminator.
int EndOffset { get; }
Property Value
- System.Int32:
The offset at which the line ends, excluding any line terminator.
EndOffsetIncludingLineTerminator
Gets the offset at which the line ends, including the line terminator if there is a hard line break on the line.
int EndOffsetIncludingLineTerminator { get; }
Property Value
- System.Int32:
The offset at which the line ends, including the line terminator if there is a hard line break on the line.
EndPosition
Gets the TextPosition at which the line ends, excluding any line terminator.
TextPosition EndPosition { get; }
Property Value
- TextPosition:
The TextPosition at which the line ends, excluding any line terminator.
EndPositionIncludingLineTerminator
Gets the TextPosition at which the line ends, including the line terminator if there is a hard line break on the line.
TextPosition EndPositionIncludingLineTerminator { get; }
Property Value
- TextPosition:
The TextPosition at which the line ends, including the line terminator if there is a hard line break on the line.
FirstNonWhitespaceCharacterIndex
Gets the index of the first non-whitespace character in the line.
int FirstNonWhitespaceCharacterIndex { get; }
Property Value
- System.Int32:
The index of the first non-whitespace character in the line.
FirstNonWhitespaceOffset
Gets the offset of the first non-whitespace character in the line.
int FirstNonWhitespaceOffset { get; }
Property Value
- System.Int32:
The offset of the first non-whitespace character in the line.
HasHardLineBreak
Gets whether the the line has a hard line break.
bool HasHardLineBreak { get; }
Property Value
- System.Boolean:
true
if the the line has a hard line break; otherwise,false
.
Remarks
This property will return false
when there is a word-wrapped line following the line.
IndentAmount
Gets the number of columns that the first non-whitespace character is indented on the line.
int IndentAmount { get; }
Property Value
- System.Int32:
The number of columns that the first non-whitespace character is indented on the line.
IsFirstLine
Gets whether the line contains the first offset of the document.
bool IsFirstLine { get; }
Property Value
- System.Boolean:
true
if the line contains the first offset of the document; otherwise,false
.
IsLastLine
Gets whether the line contains the last offset of the document.
bool IsLastLine { get; }
Property Value
- System.Boolean:
true
if the line contains the last offset of the document; otherwise,false
.
IsPureWhitespace
Gets whether the line consists purely of whitespace characters.
bool IsPureWhitespace { get; }
Property Value
- System.Boolean:
true
if the line consists purely of whitespace characters; otherwise,false
.
IsVirtualLine
Gets whether the line is a virtual line, past the end of the document.
bool IsVirtualLine { get; }
Property Value
- System.Boolean:
true
if the line is a virtual line, past the end of the document; otherwise,false
.
IsWrapped
Gets whether the line is wrapped from the previous line.
bool IsWrapped { get; }
Property Value
- System.Boolean:
true
if the line is wrapped from the previous line; otherwise,false
.
MaxPosition
Gets the maximum TextPosition that can be displayed on the line.
TextPosition MaxPosition { get; }
Property Value
- TextPosition:
The maximum TextPosition that can be displayed on the line.
NextLine
Gets the ITextViewLine that is after this line.
ITextViewLine NextLine { get; }
Property Value
- ITextViewLine:
The ITextViewLine that is after this line.
PositionRange
Gets the TextPositionRange that contains the line.
TextPositionRange PositionRange { get; }
Property Value
- TextPositionRange:
The TextPositionRange that contains the line.
PreviousLine
Gets the ITextViewLine that is before this line.
ITextViewLine PreviousLine { get; }
Property Value
- ITextViewLine:
The ITextViewLine that is before this line.
SavePointChangeType
Gets a SavePointChangeType that indicates the type of change that has been made on the line relative to the save point.
SavePointChangeType SavePointChangeType { get; }
Property Value
- SavePointChangeType:
A SavePointChangeType that indicates the type of change that has been made on the line relative to the save point.
Size
Gets the Size
of the line, including any margin space.
Size Size { get; }
Property Value
- System.Windows.Size:
The
Size
of the line, including any margin space.
SnapshotRange
Gets the TextSnapshotRange that indicates the snapshot range of the line.
TextSnapshotRange SnapshotRange { get; }
Property Value
- TextSnapshotRange:
The TextSnapshotRange that indicates the snapshot range of the line.
SnapshotRangeIncludingLineTerminator
Gets the TextSnapshotRange that indicates the snapshot range of the line, including the line terminator if there is a hard line break on the line.
TextSnapshotRange SnapshotRangeIncludingLineTerminator { get; }
Property Value
- TextSnapshotRange:
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
Gets the offset at which the line starts.
int StartOffset { get; }
Property Value
- System.Int32:
The offset at which the line starts.
StartPosition
Gets the TextPosition at which the line starts.
TextPosition StartPosition { get; }
Property Value
- TextPosition:
The TextPosition at which the line starts.
TabStopLevel
Gets or sets the tabstop level for the line.
int TabStopLevel { get; set; }
Property Value
- System.Int32:
The tabstop level for the line.
Text
Gets or sets the text of the line, excluding the line terminator.
string Text { get; set; }
Property Value
- System.String:
The text of the line, excluding the line terminator.
Remarks
If more than one document line are encompassed on the view line, a single newline character will represent the line terminator.
TextBounds
Gets the bounds of the line within the view, excluding any margin space.
Rect TextBounds { get; }
Property Value
- System.Windows.Rect:
The bounds of the line within the view, excluding any margin space.
TextRangeIncludingLineTerminator
Gets the TextRange that indicates the text range of the line, including the line terminator if there is a hard line break on the line.
TextRange TextRangeIncludingLineTerminator { get; }
Property Value
TextSize
Gets the Size
of the line, excluding any margin space.
Size TextSize { get; }
Property Value
- System.Windows.Size:
The
Size
of the line, excluding any margin space.
TopMargin
Gets the margin length above the line's text bounds.
double TopMargin { get; }
Property Value
- System.Double:
The margin length above the line's text bounds.
TranslationY
Gets the amount by which the line was translated if the Change was Translated
.
double TranslationY { get; }
Property Value
- System.Double:
The amount by which the line was translated if the Change was
Translated
.
View
Gets the ITextView that this line is on.
Visibility
Gets a TextViewLineVisibility that indicates the visibility state of the line.
TextViewLineVisibility Visibility { get; }
Property Value
- TextViewLineVisibility:
A TextViewLineVisibility that indicates the visibility state of the line.
VisibleSnapshotRanges
Gets 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
- System.Collections.Generic.IEnumerable<TextSnapshotRange>:
The collection of visible snapshot ranges on the line, including the line terminator if there is a hard line break on the line.
VisibleStartPosition
Gets the TextPosition of the first visible character or intra-text adornment on the line.
TextPosition VisibleStartPosition { get; }
Property Value
- TextPosition:
The TextPosition of the first visible character or intra-text adornment on the line.
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
Gets the vertical index of the line as displayed for the related ITextSnapshotLine.
int WordWrapIndex { get; }
Property Value
- System.Int32:
The vertical index of the line as displayed for the related ITextSnapshotLine.
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(Int32)
Returns the offset for the specified character index within the line.
int CharacterIndexToOffset(int characterIndex)
Parameter | Type | Description |
---|---|---|
characterIndex | System.Int32 | The index of a character within the line. |
Returns
- System.Int32:
The offset for the specified character index within the line.
CharacterIndexToPosition(Int32)
Returns the TextPosition for the specified character index within the line.
TextPosition CharacterIndexToPosition(int characterIndex)
Parameter | Type | Description |
---|---|---|
characterIndex | System.Int32 | The index of a character within the line. |
Returns
- TextPosition:
The TextPosition for the specified character index within the line.
GetCharacterBounds(TextPosition)
Returns the TextBounds 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
- TextBounds:
A TextBounds containing the visible character bounds for the specified TextPosition.
GetCharacterBounds(Int32)
Returns the TextBounds for the specified offset, relative to the text area's coordinates.
TextBounds GetCharacterBounds(int offset)
Parameter | Type | Description |
---|---|---|
offset | System.Int32 | The offset whose bounds need to be retrieved. |
Returns
- TextBounds:
A TextBounds containing the visible character bounds for the specified offset.
GetCharacterColumn(TextPosition)
Returns the column index within the view for the specified character.
int GetCharacterColumn(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition of the character whose column index is being requested. |
Returns
- System.Int32:
The column index within the view for the specified character.
GetCharacterColumn(Int32)
Returns the column index within the view for the specified character.
int GetCharacterColumn(int offset)
Parameter | Type | Description |
---|---|---|
offset | System.Int32 | The offset of the character whose column index is being requested. |
Returns
- System.Int32:
The column index within the view for the specified character.
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
- System.Collections.Generic.IEnumerable<TagSnapshotRange<TTag>>:
A collection of intra-line spacer tag ranges on the line that are of the type
TTag
.
GetIntraTextSpacerBounds(Object)
Returns a TextBounds representing the bounds of the specified intra-text spacer.
TextBounds GetIntraTextSpacerBounds(object tagKey)
Parameter | Type | Description |
---|---|---|
tagKey | System.Object | The object used to uniquely identify the intra-text spacer. |
Returns
- TextBounds:
A TextBounds representing the bounds of the specified intra-text spacer.
GetIntraTextSpacerTag(Int32)
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 | System.Int32 | The index of the character to examine. |
Returns
- TagSnapshotRange<IIntraTextSpacerTag>:
The intra-text spacer tag range on the line at the specified character, if the character represents an intra-text spacer.
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
- System.Collections.Generic.IEnumerable<TagSnapshotRange<TTag>>:
A collection of intra-text spacer tag ranges on the line that are of the type
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
- System.Collections.Generic.IEnumerable<TextBounds>:
The collection of bounds for the specified TextPositionRange text.
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
- System.Collections.Generic.IEnumerable<TextBounds>:
The collection of bounds for the specified TextRange text.
Remarks
This method typically only returns more than one TextBounds if there is bi-directional text in the text range.
IsVirtualCharacter(Int32, Boolean)
Returns whether the character at the specified index is a virtual character.
bool IsVirtualCharacter(int characterIndex, bool lineTerminatorsAreVirtual)
Parameter | Type | Description |
---|---|---|
characterIndex | System.Int32 | The index of the character to examine. |
lineTerminatorsAreVirtual | System.Boolean | Indicates whether to treat line terminators as virtual characters. |
Returns
- System.Boolean:
true
if the character at the specified index is a virtual character; otherwise,false
.
LocationToCharacterIndex(Double, LocationToPositionAlgorithm)
Returns the character index that contains the specified X location, in text area-relative coordinates.
int LocationToCharacterIndex(double x, LocationToPositionAlgorithm algorithm)
Parameter | Type | Description |
---|---|---|
x | System.Double | The x-coordinate for which to search. |
algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
- System.Int32:
The character index that contains the specified X location, in text area-relative coordinates.
LocationToOffset(Double, LocationToPositionAlgorithm)
Returns the offset that contains the specified X location, in text area-relative coordinates.
int LocationToOffset(double x, LocationToPositionAlgorithm algorithm)
Parameter | Type | Description |
---|---|---|
x | System.Double | The x-coordinate for which to search. |
algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
- System.Int32:
The offset that contains the specified X location, in text area-relative coordinates.
LocationToPosition(Double, LocationToPositionAlgorithm)
Returns the TextPosition that contains the specified X location, in text area-relative coordinates.
TextPosition LocationToPosition(double x, LocationToPositionAlgorithm algorithm)
Parameter | Type | Description |
---|---|---|
x | System.Double | The x-coordinate for which to search. |
algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
- TextPosition:
The TextPosition that contains the specified X location, in text area-relative coordinates.
LocationToPosition(Double, LocationToPositionAlgorithm, Boolean)
Returns the TextPosition that contains the specified X location, in text area-relative coordinates.
TextPosition LocationToPosition(double x, LocationToPositionAlgorithm algorithm, bool forceVirtualSpace)
Parameter | Type | Description |
---|---|---|
x | System.Double | The x-coordinate for which to search. |
algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
forceVirtualSpace | System.Boolean | Whether to force virtual space to be used (for block selections). |
Returns
- TextPosition:
The TextPosition that contains the specified X location, in text area-relative coordinates.
OffsetToCharacterIndex(Int32)
Returns the character index that represents the specified offset within the line.
int OffsetToCharacterIndex(int offset)
Parameter | Type | Description |
---|---|---|
offset | System.Int32 | The offset of a character within the document. |
Returns
- System.Int32:
The character index that represents the specified offset within the line.
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. |
Returns
- System.Int32:
The character index that represents the specified TextPosition within the line.