static int fixSelectionLength ( String fullText , int selectionOffset , int selectionLength ) { if ( selectionLength < 0 ) selectionLength = 0 ; else if ( selectionOffset + selectionLength > fullText . length ( ) ) selectionLength = fullText . length ( ) - selectionOffset ; for ( ; selectionOffset + selectionLength < fullText . length ( ) ; selectionLength ++ ) { char c = fullText . charAt ( selectionOffset + selectionLength ) ; if ( isLineBreak ( c ) ) break ; } return selectionLength ; }
Fixes the selection length to get the whole line .