@Override
	public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
		int inputOffset = io.getInputOffset();
		if(io.doWrite()){
			if(offset>=inputOffset){
				return;
			}
			if(offset+length>inputOffset){
				length = inputOffset-offset;
			}
			io.nonInput(text.length()-length);
			fb.replace(offset, length, text, attrs);
		}else if(io.expectInput()){
			if(offset<inputOffset){
				length += offset-inputOffset;
				offset = inputOffset;
			}
			if(length<0)
				length=0;
			fb.replace(offset, length, text, io.getInputAttrs(attrs));
			io.inputreplace(offset-inputOffset, length, text);
		}
	}