private int createLines(String text,int insertPosition,int offset){
  int count=0;
  int start=0;
  DelimiterInfo delimiterInfo=nextDelimiterInfo(text,0);
  while (delimiterInfo != null && delimiterInfo.delimiterIndex > -1) {
    int index=delimiterInfo.delimiterIndex + (delimiterInfo.delimiterLength - 1);
    if (insertPosition + count >= fLines.size())     fLines.add(new Line(offset + start,offset + index,delimiterInfo.delimiter));
 else     fLines.add(insertPosition + count,new Line(offset + start,offset + index,delimiterInfo.delimiter));
    ++count;
    start=index + 1;
    delimiterInfo=nextDelimiterInfo(text,start);
  }
  if (start < text.length()) {
    if (insertPosition + count < fLines.size()) {
      Line l=(Line)fLines.get(insertPosition + count);
      int delta=text.length() - start;
      l.offset-=delta;
      l.length+=delta;
    }
 else {
      fLines.add(new Line(offset + start,offset + text.length() - 1,null));
      ++count;
    }
  }
  return count;
}

private int createLines ( String text , int insertPosition , int offset ) { int count = 0 ; int start = 0 ; DelimiterInfo delimiterInfo = nextDelimiterInfo ( text , 0 ) ; while ( delimiterInfo != null && delimiterInfo . delimiterIndex > - 1 ) { int index = delimiterInfo . delimiterIndex + ( delimiterInfo . delimiterLength - 1 ) ; if ( insertPosition + count >= fLines . size ( ) ) fLines . add ( new Line ( offset + start , offset + index , delimiterInfo . delimiter ) ) ; else fLines . add ( insertPosition + count , new Line ( offset + start , offset + index , delimiterInfo . delimiter ) ) ; ++ count ; start = index + 1 ; delimiterInfo = nextDelimiterInfo ( text , start ) ; } if ( start < text . length ( ) ) { if ( insertPosition + count < fLines . size ( ) ) { Line l = ( Line ) fLines . get ( insertPosition + count ) ; int delta = text . length ( ) - start ; l . offset -= delta ; l . length += delta ; } else { fLines . add ( new Line ( offset + start , offset + text . length ( ) - 1 , null ) ) ; ++ count ; } } return count ; }
creates the line structure for the given text . newly created lines are inserted into the line structure starting at the given position . returns the number of newly created lines .
