nl_tokens: The paragraph is selected by the Selection if : <p > - they have at least one character in common - the selection is a point within the paragraph ( 01 \ n - > 0 till 2 intersects while the span is [ 0 3 ] ) - the selection is a point within or at the end of the LAST paragraph ( 01 - > 0 till 2 intersects while the span is [ 0 2 ] ) e . g . [ 10 10 ] will intersect the paragraph [ 0 10 ] only if it s the last paragraph
pl_tokens: public boolean isSelected ( Selection sel ) { if ( sel == null ) { return false ; } if ( sel . isEmpty ( ) ) { // selection is a point boolean isCompletelyWithin = sel . start ( ) >= start ( ) && sel . end ( ) < end ( ) ; // selection is completely within paragraph (not at the end) boolean isWithin = sel . start ( ) >= start ( ) && sel . end ( ) <= end ( ) ; // selection is within or at the end of the paragraph return isCompletelyWithin || ( isWithin && mIsLast ) ; } else { // selection is a range --> at least one character in common int start = Math . <mask> ( start ( ) , sel . start ( ) ) ; int end = Math . min ( end ( ) , sel . end ( ) ) ; return start < end ; } }