This is not a good idea. If someone asks for a range starting at the end of a paragraph (p, p.length), this code will automagically round it up to the start of the following paragraph. It is best to leave this under manual control of the developer, as they are the only one who knows which direction they prefer the rounding to occur.