public TextLocation findWordsRightEdge(TextLocation location) { for (int i = location.toIndex(getLines()); i <= text.length() - 1; i++) { if (i == 0) i = 1; if (isAtEndOfWord(i)) return TextLocation.fromIndex(getLines(), i); } return getEndLocation(); }
public void pasteClipboard() { String clipboard = getClipboardContents(); if (clipboard != null && clipboard.length() > 0) { int caretIndex = caretLocation.toIndex(getLines()); synchronized (this) { text.insert(caretIndex, clipboard); clearCache(); } setCaretLocation(TextLocation.fromIndex(getLines(), caretIndex + clipboard.length())); } }
public int getX(int index) { TextLocation location = TextLocation.fromIndex(getLines(), index); return getX(location); }
public TextLocation getEndLocation() { return TextLocation.fromIndex(getLines(), text.length()); }
protected TextLocation findNextWordSkippingSpacesOrNewLines(TextLocation startLocation) { for (int i = startLocation.toIndex(getLines()); i <= text.length() - 1; i++) { if (isAtStartOfWord(i)) return TextLocation.fromIndex(getLines(), i); } return getEndLocation(); }
public TextLocation findWordsLeftEdge(TextLocation location) { for (int i = location.toIndex(getLines()); i > 1; i--) { if (isAtStartOfWord(i)) return TextLocation.fromIndex(getLines(), i); } return TextLocation.origin; }