public void insertString(int offset,
            String str,
            AttributeSet a)
            throws BadLocationException{
		if(getReadOnly()) return; //Reject insert
		removeLineHighlight();
		AttributeSet attribute;
		if(getLength()>0){
			if(offset == 0) attribute=getCharacterElement(0).getAttributes();
			else attribute=getCharacterElement(offset-1).getAttributes();
		}
		else attribute=font.getRegular();
		super.insertString(offset, str,attribute);
		//Save undo info
		//Try to compact action
		boolean compacted=false;
		if(done.size()>0 && str.length() == 1){
			Changes last=(Changes)done.getLast();
			if(last.isInsertion() && last.isModificable()
			   && last.getPosition()+last.getText().length() == offset){
				last.appendText(str);
				compacted=true;
			}
		}
		if(!compacted)
		  done.add(new Changes(true,str,offset));
		changed(offset);
	}