buffer.endCompoundEdit();
buffer.remove(s.start,s.end - s.start); if(selectedText != null && selectedText.length() != 0) { buffer.insert(s.start,selectedText); }
	public void setSelectedText(String selectedText)	{		if(!isEditable())		{			throw new InternalError("Text component"				+ " read only");		}		Selection[] selection = getSelection();		if(selection.length == 0)		{			// for compatibility with older jEdit versions			buffer.insert(caret,selectedText);		}		else		{			try			{				buffer.beginCompoundEdit();				for(int i = 0; i < selection.length; i++)				{					setSelectedText(selection[i],selectedText);				}			}			finally			{				buffer.endCompoundEdit();			}		}		selectNone();	} //}}}