Hi,
using insertText method to insert text on position that is before (lower numeric value) cursor position causes cursor to move to different place in text. Numeric value of cursor position does not change, but after inserting text it points to different place in text and looks like selection has been changed.
For example, lets say we have simple document with increasing numbers (selection is marked with bold):
123456789
If we select number 9 then selection interval will be: { start: 8, length: 1 }
Now after insertText(0, 'text') text will be changed to:
text123456789
But selection interval stays the same: { start: 8, length: 1 } and now it points to number 5, so from users perspective selection changes from number 9 to number 5.
I would expect that selection interval will be adjusted so the same text will remain selected after inserting text or alternatively cursor will be moved to end of inserted text.
Similar problem occurs when Undo is performed for text inserted by insertText, selection "moves" in opposite direction, closer to end of document.
Thank you