Document modification between two lines of code


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:

Pretty rare situation, but i've got one myself. Pressed key and selected fragment of the text disappeared and i've got same seption.

Any suggestions?



The exception seems to be in getLineNumber, so in the first line. It indicates that the document is empty, and your offset is >0. It seems that the indexing is happening on an uncommitted document, and it's a normal situation, so you shouldn't rely on the document text at all during indexing.


oh, crap. my bad, again :) Thanks.