Whenever I insert some code/text via PSI the cursor moves in my code. Or
more accurately ( IMO ), the cursor offset remains the same, but as theirs
new text in the buffer, the apparant location has changed.
I tried to get around this using:
documentEvent.getOffset() + element.getLength());
Where element is what I just inserted. This does move the cursor
further along in the document, but it doesn't move it back to where the
cursor originally was ( due to padding and spacing also being inserted
that's not part of the PsiDocElement.
Any solutions to this? Also, I'm inserting a javadoc block, how can I get
this lined up/formatted properly with the current indentation of the
element I'm addBefore()'ing to?