RTEditor/src/main/java/com/onegravity/rteditor/RTEditText.java
public Selection getParagraphsInSelection() {
        RTLayout layout = getRTLayout();

        Selection selection = new Selection(this);
        int firstLine = layout.getLineForOffset(selection.start());
        int end = selection.isEmpty() ? selection.end() : selection.end() - 1;
        int lastLine = layout.getLineForOffset(end);

        return new Selection(layout.getLineStart(firstLine), layout.getLineEnd(lastLine));
    }
public Selection getParagraphsInSelection() {
        RTLayout layout = getRTLayout();

        Selection selection = new Selection(this);
        int firstLine = layout.getLineForOffset(selection.start());
        int end = selection.isEmpty() ? selection.end() : selection.end() - 1;
        int lastLine = layout.getLineForOffset(end);

        return new Selection(layout.getLineStart(firstLine), layout.getLineEnd(lastLine));
    }
public Selection getParagraphsInSelection ( ) { RTLayout layout = getRTLayout ( ) ; Selection selection = new Selection ( this ) ; int firstLine = layout . getLineForOffset ( selection . start ( ) ) ; int end = selection . isEmpty ( ) ? selection . end ( ) : selection . end ( ) - 1 ; int lastLine = layout . getLineForOffset ( end ) ; return new Selection ( layout . getLineStart ( firstLine ) , layout . getLineEnd ( lastLine ) ) ; }
Find the start and end of the paragraph(s) encompassing the current selection.
A paragraph spans from one \n (exclusive) to the next one (inclusive)
Find the start and end of the paragraph ( s ) encompassing the current selection . A paragraph spans from one \ n ( exclusive ) to the next one ( inclusive )