Got a problem and not sure how to handle it:
int elementLastLine = document.getLineNumber(elementEndOffset);
int lineEndOffset = document.getLineEndOffset(elementLastLine);
First line woks fine. And the second one causes: http://camelcade.myjetbrains.com/youtrack/issue/CAMELCADE-235
Pretty rare situation, but i've got one myself. Pressed key and selected fragment of the text disappeared and i've got same seption.