public final class CaretInfo extends Object
EditorCaret
.
CaretItem
.
CaretItem is not accessible through the caret API and it's managed privately by EditorCaret.
Once the caret item gets mutated its corresponding caret info becomes obsolete
and new caret info instance gets created lazily.EditorCaret
Modifier and Type | Method and Description |
---|---|
int |
getDot()
Fetches the current position of the caret.
|
Position.Bias |
getDotBias()
Get a bias of the dot position which is either
Position.Bias.Forward or Position.Bias.Backward depending
on whether the caret biases towards the next character or previous one. |
Position |
getDotPosition()
Get position of the caret itself.
|
Point |
getMagicCaretPosition()
Gets the current caret visual location.
|
int |
getMark()
Fetches the current position of the mark.
|
Position.Bias |
getMarkBias()
Get a bias of the mark position which is either
Position.Bias.Forward or Position.Bias.Backward depending
on whether the caret biases towards the next character or previous one. |
Position |
getMarkPosition()
Return either the same object like
CaretInfo.getDotPosition() if there's no selection
or return position denoting the other end of an existing selection (which is either before
or after the dot position depending of how the selection was created). |
int |
getSelectionEnd()
Returns the selected text's end position.
|
int |
getSelectionStart()
Returns the selected text's start position.
|
boolean |
isSelection()
Determines if there currently is a selection.
|
boolean |
isSelectionShowing()
Determines if the selection is currently visible.
|
String |
toString() |
@CheckForNull public Position getDotPosition()
ComplexPositions
may be used if necessary.@NonNull public Position.Bias getDotBias()
Position.Bias.Forward
or Position.Bias.Backward
depending
on whether the caret biases towards the next character or previous one.
The bias is always forward for non bidirectional text.@CheckForNull public Position getMarkPosition()
CaretInfo.getDotPosition()
if there's no selection
or return position denoting the other end of an existing selection (which is either before
or after the dot position depending of how the selection was created).ComplexPositions
may be used if necessary.@NonNull public Position.Bias getMarkBias()
Position.Bias.Forward
or Position.Bias.Backward
depending
on whether the caret biases towards the next character or previous one.
The bias is always forward for non bidirectional text.public int getDot()
public int getMark()
public boolean isSelection()
public boolean isSelectionShowing()
CaretInfo.isSelection()
and EditorCaret.isSelectionVisible()
are true.public int getSelectionStart()
public int getSelectionEnd()
@CheckForNull public Point getMagicCaretPosition()