X-Git-Url: http://git.jetbrains.org/?p=idea%2Fcommunity.git;a=blobdiff_plain;f=platform%2Feditor-ui-api%2Fsrc%2Fcom%2Fintellij%2Fopenapi%2Feditor%2FCaret.java;h=41b6329c05356283493d940c7d4bb828210a8395;hp=8e85f25ca51a34c5c2a8612e8c7762a76783a350;hb=f26f0872015ef319de4282fbf9800041de1a4e25;hpb=0ef3e04e708ce980ae3be8c7745e5ef9318b5295;ds=sidebyside diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java index 8e85f25..41b6329 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/Caret.java @@ -23,6 +23,8 @@ import org.jetbrains.annotations.Nullable; /** * Represents a specific caret instance in the editor. * Provides methods to query and modify caret position and caret's associated selection. + *
+ * Instances of this interface are supposed to be obtained from {@link CaretModel} instance, and not created explicitly.
*/
public interface Caret extends UserDataHolderEx, Disposable {
/**
@@ -75,7 +77,7 @@ public interface Caret extends UserDataHolderEx, Disposable {
void moveToVisualPosition(@NotNull VisualPosition pos);
/**
- * Short hand for calling {@link #moveToOffset(int, boolean)} with 'false'
as a second argument.
+ * Short hand for calling {@link #moveToOffset(int, boolean)} with {@code 'false'} as a second argument.
*
* @param offset the offset to move to
*/
@@ -100,7 +102,7 @@ public interface Caret extends UserDataHolderEx, Disposable {
*
true
if caret position is up-to-date for now; false
otherwise
+ * @return {@code true} if caret position is up-to-date for now; {@code false} otherwise
*/
boolean isUpToDate();
@@ -227,7 +229,7 @@ public interface Caret extends UserDataHolderEx, Disposable {
* System selection will be updated, if such feature is supported by current editor.
*
* @param startOffset start selection offset
- * @param endPosition end visual position of the text range to select (null
argument means that
+ * @param endPosition end visual position of the text range to select ({@code null} argument means that
* no specific visual position should be used)
* @param endOffset end selection offset
*/
@@ -242,9 +244,9 @@ public interface Caret extends UserDataHolderEx, Disposable {
*
* System selection will be updated, if such feature is supported by current editor.
*
- * @param startPosition start visual position of the text range to select (null
argument means that
+ * @param startPosition start visual position of the text range to select ({@code null} argument means that
* no specific visual position should be used)
- * @param endPosition end visual position of the text range to select (null
argument means that
+ * @param endPosition end visual position of the text range to select ({@code null} argument means that
* no specific visual position should be used)
* @param startOffset start selection offset
* @param endOffset end selection offset
@@ -258,9 +260,9 @@ public interface Caret extends UserDataHolderEx, Disposable {
*
null
argument means that
+ * @param startPosition start visual position of the text range to select ({@code null} argument means that
* no specific visual position should be used)
- * @param endPosition end visual position of the text range to select (null
argument means that
+ * @param endPosition end visual position of the text range to select ({@code null} argument means that
* no specific visual position should be used)
* @param startOffset start selection offset
* @param endOffset end selection offset
@@ -292,25 +294,40 @@ public interface Caret extends UserDataHolderEx, Disposable {
* Clones the current caret and positions the new one right above or below the current one. If current caret has selection, corresponding
* selection will be set for the new caret.
*
- * @param above if true
, new caret will be created at the previous line, if false
- on the next line
- * @return newly created caret instance, or null
if the caret cannot be created because it already exists at the new location
+ * @param above if {@code true}, new caret will be created at the previous line, if {@code false} - on the next line
+ * @return newly created caret instance, or {@code null} if the caret cannot be created because it already exists at the new location
* or caret model doesn't support multiple carets.
*/
@Nullable
Caret clone(boolean above);
/**
- * Returns true
if caret is located in RTL text fragment. In that case visual column number is inversely related
+ * Returns {@code true} if caret is located in RTL text fragment. In that case visual column number is inversely related
* to offset and logical column number in the vicinity of caret.
*/
boolean isAtRtlLocation();
/**
- * Returns true
if caret is located at a boundary between different runs of bidirectional text.
+ * Returns {@code true} if caret is located at a boundary between different runs of bidirectional text.
* This means that text fragments at different sides of the boundary are non-adjacent in logical order.
* Caret can located at any side of the boundary,
* exact location can be determined from directionality flags of caret's logical and visual position
* ({@link LogicalPosition#leansForward} and {@link VisualPosition#leansRight}).
*/
boolean isAtBidiRunBoundary();
+
+ /**
+ * Returns visual attributes currently set for the caret.
+ *
+ * @see #setVisualAttributes(CaretVisualAttributes)
+ */
+ @NotNull
+ CaretVisualAttributes getVisualAttributes();
+
+ /**
+ * Sets caret's current visual attributes. This can have no effect if editor doesn't support changing caret's visual appearance.
+ *
+ * @see #getVisualAttributes()
+ */
+ void setVisualAttributes(@NotNull CaretVisualAttributes attributes);
}