use of limelight.ui.text.TypedLayout in project limelight by slagyr.
the class TextModel method moveCaretToNewLine.
public void moveCaretToNewLine(int lineDelta) {
ArrayList<TypedLayout> lines = getLines();
int newLineNumber = caretLocation.line + lineDelta;
if (newLineNumber >= 0 && newLineNumber < lines.size()) {
TextLocation origin = verticalOrigin != null ? verticalOrigin : caretLocation;
int desiredX = lines.get(origin.line).getX(origin.index);
TypedLayout newLine = lines.get(newLineNumber);
int newIndex = newLine.getIndexAt(desiredX);
TextLocation newLocation = TextLocation.at(newLineNumber, newIndex);
setCaretLocation(newLocation);
verticalOrigin = origin;
}
}
use of limelight.ui.text.TypedLayout in project limelight by slagyr.
the class TextModel method sendCaretToEndOfLine.
public void sendCaretToEndOfLine() {
final TextLocation caret = getCaretLocation();
TypedLayout caretLine = getLines().get(caret.line);
setCaretLocation(TextLocation.at(caret.line, caretLine.visibleLength()));
}
use of limelight.ui.text.TypedLayout in project limelight by slagyr.
the class TextInputKeyProcessor method canMoveRight.
private boolean canMoveRight(TextModel model) {
final TextLocation caret = model.getCaretLocation();
final TypedLayout line = model.getLines().get(caret.line);
return caret.index < line.length() || canMoveDown(model);
}
Aggregations