ITextCaret Interface

Definition

Represents the caret associated with an ITextView.

public interface class ITextCaret
public interface class ITextCaret
__interface ITextCaret
public interface ITextCaret
type ITextCaret = interface
Public Interface ITextCaret

Remarks

Most properties and parameters that are doubles correspond to coordinates or distances in the text rendering coordinate system. In this coordinate system, x = 0.0 corresponds to the left edge of the drawing surface onto which text is rendered (x = view.ViewportLeft corresponds to the left edge of the viewport), and y = view.ViewportTop corresponds to the top edge of the viewport. The x-coordinate increases from left to right, and the y-coordinate increases from top to bottom.

The horizontal and vertical axes of the view behave differently. When the text in the view is formatted, only the visible lines are formatted. As a result, a viewport cannot be scrolled horizontally and vertically in the same way.

A viewport is scrolled horizontally by changing the left coordinate of the viewport so that it moves with respect to the drawing surface.

A view can be scrolled vertically only by performing a new layout.

Doing a layout in the view may cause the ViewportTop property of the view to change. For example, scrolling down one line will not translate any of the visible lines. Instead it will simply change the view's ViewportTop property (causing the lines to move on the screen even though their y-coordinates have not changed).

Distances in the text rendering coordinate system correspond to logical pixels. If the text rendering surface is displayed without any scaling transform, then 1 unit in the text rendering coordinate system corresponds to one pixel on the display.

Properties

Bottom

Gets the position of the bottom edge of the caret in the text rendering coordinate system.

ContainingTextViewLine

Gets the ITextViewLine that contains the caret, provided that that text line is visible in the view.

Height

Gets the height of the caret in the text rendering coordinate system.

InVirtualSpace

Determines whether the caret lies in virtual space. A virtual space is one that is after the physical end of a line.

IsHidden

Gets or sets the visibility of the caret.

Left

Gets the position of the left edge of the caret in the text rendering coordinate system.

OverwriteMode

Determines whether the caret is in overwrite mode.

Position

Gets the current position of the caret.

Right

Gets the position of the right edge of the caret in the text rendering coordinate system.

Top

Gets the position of the top edge of the caret in the text rendering coordinate system.

Width

Gets the width of the caret in the text rendering coordinate system.

Methods

EnsureVisible()

Makes the caret visible by scrolling the view up or down and left or right until the caret is visible.

MoveTo(ITextViewLine)

Moves the caret to the specified textLine while preserving its current x-coordinate.

MoveTo(ITextViewLine, Double)

Moves the caret to the best CaretPosition for the specified x-coordinate and text line.

MoveTo(ITextViewLine, Double, Boolean)

Moves the caret to the best CaretPosition for the given x-coordinate and text line.

MoveTo(SnapshotPoint)

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

MoveTo(SnapshotPoint, PositionAffinity)

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

MoveTo(SnapshotPoint, PositionAffinity, Boolean)

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

MoveTo(VirtualSnapshotPoint)

Moves the caret to the specified bufferPosition.

MoveTo(VirtualSnapshotPoint, PositionAffinity)

Moves the caret to the specified bufferPosition.

MoveTo(VirtualSnapshotPoint, PositionAffinity, Boolean)

Moves the caret to the specified bufferPosition.

MoveToNextCaretPosition()

Moves the caret to the next valid CaretPosition.

MoveToPreferredCoordinates()

Moves the caret to the preferred x and y-coordinates.

MoveToPreviousCaretPosition()

Moves the caret to the previous valid CaretPosition.

Events

PositionChanged

Occurs when the position of the caret has been explicitly changed.

Applies to