CaretPosition Structure

 

Represents the position of a caret in an ITextView.

Namespace:   Microsoft.VisualStudio.Text.Editor
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

public struct CaretPosition

NameDescription
System_CAPS_pubmethodCaretPosition(VirtualSnapshotPoint, IMappingPoint, PositionAffinity)

Initializes a new instance of a CaretPosition.

NameDescription
System_CAPS_pubpropertyAffinity

Gets the affinity of the caret.

System_CAPS_pubpropertyBufferPosition

Gets the position of the caret, corresponding to a gap between two characters in the ITextBuffer of the view.

System_CAPS_pubpropertyPoint

Gets the IMappingPoint that marks the position of the caret in the buffer.

System_CAPS_pubpropertyVirtualBufferPosition

Gets the virtual buffer position as a VirtualSnapshotPoint.

System_CAPS_pubpropertyVirtualSpaces

Gets the number of spaces past the physical end of the line of the caret position.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether two CaretPosition objects are the same(Overrides ValueType.Equals(Object).)

System_CAPS_pubmethodGetHashCode()

Gets the hash code for the CaretPosition.(Overrides ValueType.GetHashCode().)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

Provides a string representation of the caret position.(Overrides ValueType.ToString().)

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticEquality(CaretPosition, CaretPosition)

Determines whether two CaretPosition objects are the same.

System_CAPS_puboperatorSystem_CAPS_staticInequality(CaretPosition, CaretPosition)

Determines whether two CaretPosition objects are different.

To get the caret's current position, you can listen to the PositionChanged event. (You can get the caret from the ITextView.)The ITextCaret class includes methods that allow you to move the caret to a different position.

For an example of finding the caret position, see Walkthrough: Displaying Matching Braces.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: