How to set cursor position after inserting text
ashitvora-zz opened this issue · 0 comments
ashitvora-zz commented
I have a use case where a user clicks a button to insert text at the current cursor position.
But after the text is inserted using session.insert(cursorPosition, textToAdd)
, the position of cursor moves to the very first character.
I tried placing the cursor after the recently added text by using the following approach but it didn't work.
renderer.scrollCursorIntoView({
row: cursorPosition.row,
column: cursorPosition.column + param.length
}, 0.5)
Any idea how to achieve this?
Basically, if a user keeps clicking the button, text to should be added at the current cursor position and then after the recently added text unless user places the cursor somewhere else explicitly.
Here's the JS Fiddle for the reference - https://jsfiddle.net/ashitvora/q27ebeeq/34/