ITextCaret.MoveTo Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
MoveTo(VirtualSnapshotPoint, PositionAffinity, Boolean) |
Moves the caret to the specified |
MoveTo(SnapshotPoint, PositionAffinity, Boolean) |
Moves the caret to the given index in the underlying ITextBuffer. |
MoveTo(ITextViewLine, Double, Boolean) |
Moves the caret to the best CaretPosition for the given x-coordinate and text line. |
MoveTo(SnapshotPoint, PositionAffinity) |
Moves the caret to the given index in the underlying ITextBuffer. |
MoveTo(VirtualSnapshotPoint, PositionAffinity) |
Moves the caret to the specified |
MoveTo(VirtualSnapshotPoint) |
Moves the caret to the specified |
MoveTo(SnapshotPoint) |
Moves the caret to the given index in the underlying ITextBuffer. |
MoveTo(ITextViewLine) |
Moves the caret to the specified |
MoveTo(ITextViewLine, Double) |
Moves the caret to the best CaretPosition for the specified x-coordinate and text line. |
MoveTo(VirtualSnapshotPoint, PositionAffinity, Boolean)
Moves the caret to the specified bufferPosition
.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::VirtualSnapshotPoint bufferPosition, Microsoft::VisualStudio::Text::PositionAffinity caretAffinity, bool captureHorizontalPosition);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.VirtualSnapshotPoint bufferPosition, Microsoft.VisualStudio.Text.PositionAffinity caretAffinity, bool captureHorizontalPosition);
abstract member MoveTo : Microsoft.VisualStudio.Text.VirtualSnapshotPoint * Microsoft.VisualStudio.Text.PositionAffinity * bool -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (bufferPosition As VirtualSnapshotPoint, caretAffinity As PositionAffinity, captureHorizontalPosition As Boolean) As CaretPosition
Parameters
- bufferPosition
- VirtualSnapshotPoint
The VirtualSnapshotPoint in the underlying text buffer to which to move the caret.
- caretAffinity
- PositionAffinity
The affinity of the caret. This will be ignored unless bufferPosition
specifies a location that is at the seam between two word-wrapped lines.
- captureHorizontalPosition
- Boolean
If true
, the caret will capture its horizontal position for subsequent moves up or down.
If false
, the caret retains its previously-captured horizontal position.
Returns
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.
Applies to
MoveTo(SnapshotPoint, PositionAffinity, Boolean)
Moves the caret to the given index in the underlying ITextBuffer.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::SnapshotPoint bufferPosition, Microsoft::VisualStudio::Text::PositionAffinity caretAffinity, bool captureHorizontalPosition);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, Microsoft.VisualStudio.Text.PositionAffinity caretAffinity, bool captureHorizontalPosition);
abstract member MoveTo : Microsoft.VisualStudio.Text.SnapshotPoint * Microsoft.VisualStudio.Text.PositionAffinity * bool -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (bufferPosition As SnapshotPoint, caretAffinity As PositionAffinity, captureHorizontalPosition As Boolean) As CaretPosition
Parameters
- bufferPosition
- SnapshotPoint
The SnapshotPoint in the underlying text buffer to which to move the caret.
- caretAffinity
- PositionAffinity
The affinity of the caret. This will be ignored unless
bufferPosition
specifies a location that is at the seam between two word-wrapped lines.
- captureHorizontalPosition
- 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.
Returns
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
isPredecessor, the actual valid caret index is 2.
Applies to
MoveTo(ITextViewLine, Double, Boolean)
Moves the caret to the best CaretPosition for the given x-coordinate and text line.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::Formatting::ITextViewLine ^ textLine, double xCoordinate, bool captureHorizontalPosition);
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::Formatting::ITextViewLine const & textLine, double xCoordinate, bool captureHorizontalPosition);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.Formatting.ITextViewLine textLine, double xCoordinate, bool captureHorizontalPosition);
abstract member MoveTo : Microsoft.VisualStudio.Text.Formatting.ITextViewLine * double * bool -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (textLine As ITextViewLine, xCoordinate As Double, captureHorizontalPosition As Boolean) As CaretPosition
Parameters
- textLine
- ITextViewLine
The text line that will contain the caret.
- xCoordinate
- Double
The x-coordinate of the caret in the text rendering coordinate system.
- captureHorizontalPosition
- 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.
Returns
A CaretPosition that contains the valid values of the caret after the move has occurred.
Exceptions
xCoordinate
is NaN.
Remarks
This method takes care of UTF-16 surrogate pairs and combining character sequences.
Applies to
MoveTo(SnapshotPoint, PositionAffinity)
Moves the caret to the given index in the underlying ITextBuffer.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::SnapshotPoint bufferPosition, Microsoft::VisualStudio::Text::PositionAffinity caretAffinity);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition, Microsoft.VisualStudio.Text.PositionAffinity caretAffinity);
abstract member MoveTo : Microsoft.VisualStudio.Text.SnapshotPoint * Microsoft.VisualStudio.Text.PositionAffinity -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (bufferPosition As SnapshotPoint, caretAffinity As PositionAffinity) As CaretPosition
Parameters
- bufferPosition
- SnapshotPoint
The SnapshotPoint in the underlying text buffer to which to move the caret.
- caretAffinity
- PositionAffinity
The affinity of the caret. This will be ignored unless
bufferPosition
specifies a location that is at the seam between two word-wrapped lines.
Returns
A CaretPosition that contains the valid values of the caret position after the move has occurred.
Remarks
This is equivalent to calling MoveTo(bufferPosition, caretAffinity, true).
Applies to
MoveTo(VirtualSnapshotPoint, PositionAffinity)
Moves the caret to the specified bufferPosition
.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::VirtualSnapshotPoint bufferPosition, Microsoft::VisualStudio::Text::PositionAffinity caretAffinity);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.VirtualSnapshotPoint bufferPosition, Microsoft.VisualStudio.Text.PositionAffinity caretAffinity);
abstract member MoveTo : Microsoft.VisualStudio.Text.VirtualSnapshotPoint * Microsoft.VisualStudio.Text.PositionAffinity -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (bufferPosition As VirtualSnapshotPoint, caretAffinity As PositionAffinity) As CaretPosition
Parameters
- bufferPosition
- VirtualSnapshotPoint
The VirtualSnapshotPoint in the underlying text buffer to which to move the caret.
- caretAffinity
- PositionAffinity
The affinity of the caret. This will be ignored unless bufferPosition
specifies a location that is at the seam between two word-wrapped lines.
Returns
A CaretPosition that contains the valid values of the caret position after the move has occurred.
Remarks
This is equivalent to calling MoveTo(bufferPosition, caretAffinity, true).
Applies to
MoveTo(VirtualSnapshotPoint)
Moves the caret to the specified bufferPosition
.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::VirtualSnapshotPoint bufferPosition);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.VirtualSnapshotPoint bufferPosition);
abstract member MoveTo : Microsoft.VisualStudio.Text.VirtualSnapshotPoint -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (bufferPosition As VirtualSnapshotPoint) As CaretPosition
Parameters
- bufferPosition
- VirtualSnapshotPoint
The VirtualSnapshotPoint in the underlying text buffer to which to move the caret.
Returns
A CaretPosition that contains the valid values of the caret position after the move has occurred.
Remarks
This is equivalent to calling MoveTo(bufferPosition, PositionAffinity.Successor, true).
Applies to
MoveTo(SnapshotPoint)
Moves the caret to the given index in the underlying ITextBuffer.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::SnapshotPoint bufferPosition);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition);
abstract member MoveTo : Microsoft.VisualStudio.Text.SnapshotPoint -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (bufferPosition As SnapshotPoint) As CaretPosition
Parameters
- bufferPosition
- SnapshotPoint
The SnapshotPoint in the underlying text buffer to which to move the caret.
Returns
A CaretPosition that contains the valid values of the caret after the move has occurred.
Remarks
This is equivalent to calling MoveTo(bufferPosition, PositionAffinity.Successor, true).
Applies to
MoveTo(ITextViewLine)
Moves the caret to the specified textLine
while preserving its current x-coordinate.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::Formatting::ITextViewLine ^ textLine);
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::Formatting::ITextViewLine const & textLine);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.Formatting.ITextViewLine textLine);
abstract member MoveTo : Microsoft.VisualStudio.Text.Formatting.ITextViewLine -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (textLine As ITextViewLine) As CaretPosition
Parameters
- textLine
- ITextViewLine
The text line that will contain the caret.
Returns
A CaretPosition that contains the valid values of the caret after the move has occurred.
Applies to
MoveTo(ITextViewLine, Double)
Moves the caret to the best CaretPosition for the specified x-coordinate and text line.
public:
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::Formatting::ITextViewLine ^ textLine, double xCoordinate);
Microsoft::VisualStudio::Text::Editor::CaretPosition MoveTo(Microsoft::VisualStudio::Text::Formatting::ITextViewLine const & textLine, double xCoordinate);
public Microsoft.VisualStudio.Text.Editor.CaretPosition MoveTo (Microsoft.VisualStudio.Text.Formatting.ITextViewLine textLine, double xCoordinate);
abstract member MoveTo : Microsoft.VisualStudio.Text.Formatting.ITextViewLine * double -> Microsoft.VisualStudio.Text.Editor.CaretPosition
Public Function MoveTo (textLine As ITextViewLine, xCoordinate As Double) As CaretPosition
Parameters
- textLine
- ITextViewLine
The text line that will contain the caret.
- xCoordinate
- Double
The x-coordinate of the caret in the text rendering coordinate system.
Returns
A CaretPosition that contains the valid values of the caret after the move has occurred.
Exceptions
xCoordinate
is NaN.
Remarks
This is equivalent to calling MoveTo(textLine, xCoordinate, true).