Exemplo n.º 1
0
  public String getSelectedText() {
    if (!hasSelection()) return "";

    int startIndex = getSelectionStart().toIndex(getLines());
    int endIndex = getSelectionEnd().toIndex(getLines());

    return text.substring(startIndex, endIndex);
  }