code: static int fixSelectionOffset( String fullText, int selectionOffset ) {
  
  		if( selectionOffset < 0 || selectionOffset >= fullText.length())
  			selectionOffset = 0;
  
  		// Get the full line
  		int lineBreakIndex = selectionOffset - 1;
  		for( ; lineBreakIndex >= 0; lineBreakIndex -- ) {
  			char c = fullText.charAt( lineBreakIndex );
  			if( isLineBreak( c )) {
  				lineBreakIndex ++;
  				break;
  			}
  		}
  
  		return lineBreakIndex < 0 ? 0 : lineBreakIndex;
  	}
docs: Fixes the selection offset to get the whole line.
  <p>
  Invalid values result in zero.
  </p>
  
  @param fullText the full text (not null)
  @param selectionOffset the selection offset
  @return a valid selection offset, set to the beginning of the last line or of the text