@NotNull public Pair<String,Integer> print(@NotNull String s,@NotNull ConsoleViewContentType contentType,@Nullable HyperlinkInfo info){
  int numberOfSymbolsToProceed=s.length();
  int trimmedSymbolsNumber=myDeferredOutputLength;
  if (contentType != ConsoleViewContentType.USER_INPUT) {
    numberOfSymbolsToProceed=trimDeferredOutputIfNecessary(s.length());
    trimmedSymbolsNumber-=myDeferredOutputLength;
  }
 else {
    trimmedSymbolsNumber=0;
  }
  if (numberOfSymbolsToProceed <= 0) {
    return new Pair<String,Integer>("",0);
  }
  if (numberOfSymbolsToProceed < s.length()) {
    s=s.substring(s.length() - numberOfSymbolsToProceed);
  }
  myDeferredTypes.add(contentType);
  s=StringUtil.convertLineSeparators(s,true);
  myDeferredOutputLength+=s.length();
  StringBuilder bufferToUse;
  if (myDeferredOutput.isEmpty()) {
    myDeferredOutput.add(bufferToUse=new StringBuilder(myCyclicBufferUnitSize));
  }
 else {
    bufferToUse=myDeferredOutput.getLast();
  }
  int offset=0;
  while (offset < s.length()) {
    if (bufferToUse.length() >= myCyclicBufferUnitSize) {
      myDeferredOutput.add(bufferToUse=new StringBuilder(myCyclicBufferUnitSize));
    }
    if (bufferToUse.length() < myCyclicBufferUnitSize) {
      int numberOfSymbolsToAdd=Math.min(myCyclicBufferUnitSize - bufferToUse.length(),s.length() - offset);
      bufferToUse.append(s.substring(offset,offset + numberOfSymbolsToAdd));
      offset+=numberOfSymbolsToAdd;
    }
  }
  if (contentType == ConsoleViewContentType.USER_INPUT) {
    myDeferredUserInput.append(s);
  }
  ConsoleUtil.addToken(s.length(),info,contentType,myDeferredTokens);
  return new Pair<String,Integer>(s,trimmedSymbolsNumber);
}

@ NotNull public Pair < String , Integer > print ( @ NotNull String s , @ NotNull ConsoleViewContentType contentType , @ Nullable HyperlinkInfo info ) { int numberOfSymbolsToProceed = s . length ( ) ; int trimmedSymbolsNumber = myDeferredOutputLength ; if ( contentType != ConsoleViewContentType . USER_INPUT ) { numberOfSymbolsToProceed = trimDeferredOutputIfNecessary ( s . length ( ) ) ; trimmedSymbolsNumber -= myDeferredOutputLength ; } else { trimmedSymbolsNumber = 0 ; } if ( numberOfSymbolsToProceed <= 0 ) { return new Pair < String , Integer > ( "" , 0 ) ; } if ( numberOfSymbolsToProceed < s . length ( ) ) { s = s . substring ( s . length ( ) - numberOfSymbolsToProceed ) ; } myDeferredTypes . add ( contentType ) ; s = StringUtil . convertLineSeparators ( s , true ) ; myDeferredOutputLength += s . length ( ) ; StringBuilder bufferToUse ; if ( myDeferredOutput . isEmpty ( ) ) { myDeferredOutput . add ( bufferToUse = new StringBuilder ( myCyclicBufferUnitSize ) ) ; } else { bufferToUse = myDeferredOutput . getLast ( ) ; } int offset = 0 ; while ( offset < s . length ( ) ) { if ( bufferToUse . length ( ) >= myCyclicBufferUnitSize ) { myDeferredOutput . add ( bufferToUse = new StringBuilder ( myCyclicBufferUnitSize ) ) ; } if ( bufferToUse . length ( ) < myCyclicBufferUnitSize ) { int numberOfSymbolsToAdd = Math . min ( myCyclicBufferUnitSize - bufferToUse . length ( ) , s . length ( ) - offset ) ; bufferToUse . append ( s . substring ( offset , offset + numberOfSymbolsToAdd ) ) ; offset += numberOfSymbolsToAdd ; } } if ( contentType == ConsoleViewContentType . USER_INPUT ) { myDeferredUserInput . append ( s ) ; } ConsoleUtil . addToken ( s . length ( ) , info , contentType , myDeferredTokens ) ; return new Pair < String , Integer > ( s , trimmedSymbolsNumber ) ; }
asks current buffer to store given text of the given type .
