buffer.append(document.get(start, whiteend - start));
buffer.append(document.get(start, Math.max(whiteend - start, 0)));
	private int getIndentSize(IDocument document, DocumentCommand command) {		StringBuffer buffer= new StringBuffer();		int docLength= document.getLength();		if (command.offset == -1 || docLength == 0)			return 0;		try {						int p= (command.offset == docLength ? command.offset - 1 : command.offset);			int line= document.getLineOfOffset(p);			IRegion region= document.getLineInformation(line);			String string= document.get(region.getOffset(), command.offset - region.getOffset());			if (line != 0 && string.trim().length() == 0)				--line;						while (line != 0 && isLineEmpty(document, line))				--line;			int start= document.getLineOffset(line);						// if line is at end of a javadoc comment, take the indent from the comment's begin line			ITypedRegion typedRegion= TextUtilities.getPartition(document, fPartitioning, start);			if (IJavaPartitions.JAVA_DOC.equals(typedRegion.getType())) {				start= document.getLineInformationOfOffset(typedRegion.getOffset()).getOffset();			} else if (IJavaPartitions.JAVA_SINGLE_LINE_COMMENT.equals(typedRegion.getType())) {				buffer.append(COMMENT);				start += 2;			}						int whiteend= findEndOfWhiteSpace(document, start, command.offset);			buffer.append(document.get(start, whiteend - start));			if (getBracketCount(document, start, command.offset, true) > 0) {				buffer.append(createIndent(1, useSpaces()));			}		} catch (BadLocationException e) {			JavaPlugin.log(e);		}				return calculateDisplayedWidth(buffer.toString(), getTabWidth());	}