break;
return true;
	private void doWordWrap(int line, String str)		throws BadLocationException	{		int maxLineLen = ((Integer)buffer.getProperty("maxLineLen"))			.intValue();		if(maxLineLen <= 0)			return;		int strLen = str.length();		Element lineElement = buffer.getDefaultRootElement()			.getElement(line);		int start = lineElement.getStartOffset();		int end = lineElement.getEndOffset();		int len = end - start - 1;		// don't wrap unless we're at the end of the line		if(getCaretPosition() != end - 1)			return;		int tabSize = buffer.getTabSize();		String wordBreakChars = (String)buffer.getProperty("wordBreakChars");		buffer.getText(start,len,lineSegment);		int lineStart = lineSegment.offset;		int logicalLength = 0; // length with tabs expanded		int lastWordOffset = -1;		boolean lastWasSpace = true;		for(int i = 0; i < len; i++)		{			char ch = lineSegment.array[lineStart + i];			if(ch == '\t')			{				logicalLength += tabSize - (logicalLength % tabSize);				if(!lastWasSpace)				{					lastWordOffset = i;					lastWasSpace = true;				}			}			else if(ch == ' ')			{				logicalLength++;				if(!lastWasSpace)				{					lastWordOffset = i;					lastWasSpace = true;				}			}			else if(wordBreakChars != null && wordBreakChars.indexOf(ch) != -1)			{				logicalLength++;				if(!lastWasSpace)				{					lastWordOffset = i;					lastWasSpace = true;				}			}			else			{				logicalLength++;				lastWasSpace = false;			}			if(logicalLength + strLen > maxLineLen && lastWordOffset != -1)			{				// break line at lastWordOffset				try				{					buffer.beginCompoundEdit();					buffer.insertString(lastWordOffset + start,"\n",null);					buffer.indentLine(line + 1,true,true);				}				finally				{					buffer.endCompoundEdit();				}				break;			}		}	}