In This Article

TextRangeTrackingModes Enum

Specifies how a text range is updated by text change operations that occur at its edges.

[Flags]
public enum TextRangeTrackingModes

Remarks

Combine various flags to achieve different tracking behavior.

Fields

Name Description
Default

The text range doesn't get deleted by deletion operations that cross it, instead is slides to the deletion start. The text range doesn't expand when insertion operations occur at its edges.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 2, the text range slides forward a character and becomes {3,5}.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 4, the text range remains {2,4}.

DeleteMask

The mask value for all delete-related values.

DeleteWhenSurrounded

Alters deletion behavior such that the text range is deleted if a deletion operation occurs that completely surrounds it. A deletion operation that collapses the text range to zero-length will not delete it.

DeleteWhenZeroLength

Alters deletion behavior such that the text range is deleted if a deletion operation occurs that surrounds it or collapses it to zero-length.

This value includes the DeleteWhenSurrounded value.

ExpandBothEdges

Alters expansion behavior such that the text range expands when insertion operations occur at either of its edges.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 2, the text range expands to become {2,5}.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 4, the text range expands to become {2,5}.

This value is the combination of the ExpandFirstEdge and ExpandLastEdge values.

ExpandFirstEdge

Alters expansion behavior such that the text range expands when insertion operations occur at its leading (first) edge.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 2, the text range expands to become {2,5}.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 4, the text range remains {2,4}.

ExpandLastEdge

Alters expansion behavior such that the text range expands when insertion operations occur at its trailing (last) edge.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 2, the text range slides forward a character and becomes {3,5}.

If the text range is {2,4}, meaning the characters at offsets 2 and 3 are included in the range, and a single character is inserted at offset 4, the text range expands to become {2,5}.

ExpandMask

The mask value for all expansion-related values.

LineBased

The text range follows the text on the line to which it is attached. This option is useful for line-based tracking, such as for bookmarks.

Inserting a line terminator in the line will move the text range to the next line, unless the line terminator is inserted at the very end of the line.

NegativeWhenZeroLength

When an insertion occurs at a zero-length text range's offset without expansion options set, the text range will not expand and will not slide in a positive (towards document end) direction.