Exemple #1
0
  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();
  }
Exemple #2
0
 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()));
   }
 }
Exemple #3
0
 public int getX(int index) {
   TextLocation location = TextLocation.fromIndex(getLines(), index);
   return getX(location);
 }
Exemple #4
0
 public TextLocation getEndLocation() {
   return TextLocation.fromIndex(getLines(), text.length());
 }
Exemple #5
0
 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();
 }
Exemple #6
0
 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;
 }