예제 #1
0
 public void deleteEnclosedText(TextLocation start, TextLocation end) {
   ArrayList<TypedLayout> lines = getLines();
   int startIndex = start.toIndex(lines);
   int endIndex = end.toIndex(lines);
   synchronized (this) {
     text.delete(startIndex, endIndex);
     clearCache();
   }
   setCaretLocation(start);
   setSelectionLocation(start);
 }
예제 #2
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();
  }
예제 #3
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()));
   }
 }
예제 #4
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();
 }
예제 #5
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;
 }