In This Article

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.

float Baseline { get; }

Property Value

float

BottomMargin

The margin length below the line's text bounds.

int BottomMargin { get; }

Property Value

int

Bounds

The bounds of the line within the view, including any margin space.

Rectangle Bounds { get; }

Property Value

Rectangle

Change

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

CharacterCount

The number of characters that are displayed on the line, excluding any collapsed text ranges.

int CharacterCount { get; }

Property Value

int

EndOffset

The offset at which the line ends, excluding any line terminator.

int EndOffset { get; }

Property Value

int

EndOffsetIncludingLineTerminator

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

int

EndPosition

The TextPosition at which the line ends, excluding any line terminator.

TextPosition EndPosition { get; }

Property Value

TextPosition

EndPositionIncludingLineTerminator

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

FirstNonWhitespaceCharacterIndex

The index of the first non-whitespace character in the line.

int FirstNonWhitespaceCharacterIndex { get; }

Property Value

int

FirstNonWhitespaceOffset

The offset of the first non-whitespace character in the line.

int FirstNonWhitespaceOffset { get; }

Property Value

int

HasHardLineBreak

Indicates whether the the line ends with a line terminator.

bool HasHardLineBreak { get; }

Property Value

bool:

true if 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.

int IndentAmount { get; }

Property Value

int

IsFirstLine

Indicates whether the line contains the first offset of the document.

bool IsFirstLine { get; }

Property Value

bool:

true if 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:

true if 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:

true if 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:

true if 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:

true if the line is wrapped from the previous line; otherwise, false .

LineTerminator

The type of line terminator that ends the line, if any.

LineTerminator? LineTerminator { get; }

Property Value

LineTerminator?

See Also

MaxPosition

The maximum TextPosition that can be displayed on the line.

TextPosition MaxPosition { get; }

Property Value

TextPosition

NextLine

The ITextViewLine that is after this line.

ITextViewLine? NextLine { get; }

Property Value

ITextViewLine

PositionRange

The TextPositionRange that contains the line.

TextPositionRange PositionRange { get; }

Property Value

TextPositionRange

PreviousLine

The ITextViewLine that is before this line.

ITextViewLine? PreviousLine { get; }

Property Value

ITextViewLine

SavePointChangeType

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

Size

The Size of the line, including any margin space.

Size Size { get; }

Property Value

Size

SnapshotRange

The TextSnapshotRange that indicates the snapshot range of the line.

TextSnapshotRange SnapshotRange { get; }

Property Value

TextSnapshotRange

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.

TextSnapshotRange SnapshotRangeIncludingLineTerminator { get; }

Property Value

TextSnapshotRange

StartOffset

The offset at which the line starts.

int StartOffset { get; }

Property Value

int

StartPosition

The TextPosition at which the line starts.

TextPosition StartPosition { get; }

Property Value

TextPosition

TabStopLevel

The tab stop level for the line.

int TabStopLevel { get; set; }

Property Value

int

Text

The text of the line, excluding the line terminator.

string Text { get; set; }

Property Value

string

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.

Rectangle TextBounds { get; }

Property Value

Rectangle

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.

TextRange TextRangeIncludingLineTerminator { get; }

Property Value

TextRange

TextSize

The Size of the line, excluding any margin space.

Size TextSize { get; }

Property Value

Size

TopMargin

The margin length above the line's text bounds.

int TopMargin { get; }

Property Value

int

TranslationY

The amount by which the line was translated if the Change was Translated.

int TranslationY { get; }

Property Value

int

View

The ITextView that this line is on.

ITextView View { get; }

Property Value

ITextView

Visibility

A TextViewLineVisibility that indicates the visibility state of the line.

TextViewLineVisibility Visibility { get; }

Property Value

TextViewLineVisibility

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

IEnumerable<TextSnapshotRange>

VisibleStartPosition

The TextPosition of the first visible character or intra-text adornment on the line.

TextPosition VisibleStartPosition { get; }

Property Value

TextPosition

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

int

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

int

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

TextPosition

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

TextBounds?

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

TextBounds?

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

int

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

int

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

TextBounds?

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

TagSnapshotRange<IIntraTextSpacerTag>

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

IEnumerable<TextBounds>

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

IEnumerable<TextBounds>

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:

true if 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

int

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

int

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

TextPosition?

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

TextPosition?

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

int

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

int

Inherited Members

Extension Methods