private void replaceInternal(Node node,String text,int length,int firstLineDelta){
  DelimiterInfo info=text == null ? null : nextDelimiterInfo(text,0);
  if (info == null || info.delimiter == null) {
    int added=text == null ? 0 : text.length();
    updateLength(node,added - length);
  }
 else {
    int remainder=firstLineDelta - length;
    String remDelim=node.delimiter;
    int consumed=info.delimiterIndex + info.delimiterLength;
    int delta=consumed - firstLineDelta;
    updateLength(node,delta);
    node.delimiter=info.delimiter;
    info=nextDelimiterInfo(text,consumed);
    while (info != null) {
      int lineLen=info.delimiterIndex - consumed + info.delimiterLength;
      node=insertAfter(node,lineLen,info.delimiter);
      consumed+=lineLen;
      info=nextDelimiterInfo(text,consumed);
    }
    insertAfter(node,remainder + text.length() - consumed,remDelim);
  }
}

private void replaceInternal ( Node node , String text , int length , int firstLineDelta ) { DelimiterInfo info = text == null ? null : nextDelimiterInfo ( text , 0 ) ; if ( info == null || info . delimiter == null ) { int added = text == null ? 0 : text . length ( ) ; updateLength ( node , added - length ) ; } else { int remainder = firstLineDelta - length ; String remDelim = node . delimiter ; int consumed = info . delimiterIndex + info . delimiterLength ; int delta = consumed - firstLineDelta ; updateLength ( node , delta ) ; node . delimiter = info . delimiter ; info = nextDelimiterInfo ( text , consumed ) ; while ( info != null ) { int lineLen = info . delimiterIndex - consumed + info . delimiterLength ; node = insertAfter ( node , lineLen , info . delimiter ) ; consumed += lineLen ; info = nextDelimiterInfo ( text , consumed ) ; } insertAfter ( node , remainder + text . length ( ) - consumed , remDelim ) ; } }
replace happening inside a single line .
