protected int calculateBreakPosition(int p0,Token tokenList,float x0){
  int p=p0;
  RSyntaxTextArea textArea=(RSyntaxTextArea)getContainer();
  float currentWidth=getWidth();
  if (currentWidth == Integer.MAX_VALUE)   currentWidth=getPreferredSpan(X_AXIS);
  currentWidth=Math.max(currentWidth,MIN_WIDTH);
  Token t=tokenList;
  while (t != null && t.isPaintable()) {
    float tokenWidth=t.getWidth(textArea,this,x0);
    if (tokenWidth > currentWidth) {
      if (p == p0) {
        return t.getOffsetBeforeX(textArea,this,0,currentWidth);
      }
      return t.isWhitespace() ? p + t.textCount : p;
    }
    currentWidth-=tokenWidth;
    x0+=tokenWidth;
    p+=t.textCount;
    t=t.getNextToken();
  }
  return p + 1;
}

protected int calculateBreakPosition ( int p0 , Token tokenList , float x0 ) { int p = p0 ; RSyntaxTextArea textArea = ( RSyntaxTextArea ) getContainer ( ) ; float currentWidth = getWidth ( ) ; if ( currentWidth == Integer . MAX_VALUE ) currentWidth = getPreferredSpan ( X_AXIS ) ; currentWidth = Math . max ( currentWidth , MIN_WIDTH ) ; Token t = tokenList ; while ( t != null && t . isPaintable ( ) ) { float tokenWidth = t . getWidth ( textArea , this , x0 ) ; if ( tokenWidth > currentWidth ) { if ( p == p0 ) { return t . getOffsetBeforeX ( textArea , this , 0 , currentWidth ) ; } return t . isWhitespace ( ) ? p + t . textCount : p ; } currentWidth -= tokenWidth ; x0 += tokenWidth ; p += t . textCount ; t = t . getNextToken ( ) ; } return p + 1 ; }
this is called by the nested wrapped line views to determine the break location . this can be reimplemented to alter the breaking behavior . it will either break at word or character boundaries depending upon the break argument given at construction .
