Freigeben über


ITextCaret.MoveTo Method (SnapshotPoint, PositionAffinity, Boolean)

Moves the caret to the given index in the underlying ITextBuffer.

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

Syntax

'Declaration
Function MoveTo ( _
    bufferPosition As SnapshotPoint, _
    caretAffinity As PositionAffinity, _
    captureHorizontalPosition As Boolean _
) As CaretPosition
CaretPosition MoveTo(
    SnapshotPoint bufferPosition,
    PositionAffinity caretAffinity,
    bool captureHorizontalPosition
)
CaretPosition MoveTo(
    SnapshotPoint bufferPosition, 
    PositionAffinity caretAffinity, 
    bool captureHorizontalPosition
)
abstract MoveTo : 
        bufferPosition:SnapshotPoint * 
        caretAffinity:PositionAffinity * 
        captureHorizontalPosition:bool -> CaretPosition
function MoveTo(
    bufferPosition : SnapshotPoint, 
    caretAffinity : PositionAffinity, 
    captureHorizontalPosition : boolean
) : CaretPosition

Parameters

  • captureHorizontalPosition
    Type: Boolean

    true if the caret should capture its horizontal position for subsequent moves up or down, false if the caret should retain its previously-captured horizontal position.

Return Value

Type: Microsoft.VisualStudio.Text.Editor.CaretPosition
A CaretPosition that contains the valid values of the caret position after the move has occurred.

Remarks

This method handles UTF-16 surrogate pairs and combining character sequences.

For example, if the text buffer consists of a high surrogate character at index 0 and a low surrogate character at index 1, and bufferPosition is 1 and caretAffinity is Successor, the actual valid caret index is 0 (since the high surrogate and low surrogate characters form one text element).

If caretAffinity is Predecessor, the actual valid caret index is 2.

.NET Framework Security

See Also

Reference

ITextCaret Interface

MoveTo Overload

Microsoft.VisualStudio.Text.Editor Namespace