Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

How to set cursor position after inserting text #184

Open
@ashitvora-zz

Description

@ashitvora-zz

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions