Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetSelections doesn't change the caret position, it is instead adding additional caret(s) on top of the current one #409

Open
luislhg opened this issue Aug 3, 2024 · 0 comments
Assignees
Milestone

Comments

@luislhg
Copy link

luislhg commented Aug 3, 2024

When using textview.AsEditable.SetSelections it is adding a new caret selection on top of the current one the editor has.

Repro
The extension command is going to set the caret selection to 5, you can notice the fifth character appears as a blue caret, while the old caret position is still kept (and respected) as the red caret.

Bug.SetSelections.mp4

Code

await Extensibility.Editor().EditAsync(
batch =>
{
    var caret5 = new TextPosition(textView.Document, 5);
    textView.AsEditable(batch).SetSelections([new Selection(activePosition: caret5, anchorPosition: caret5, insertionPosition: caret5)]);
},
cancellationToken);
@tinaschrepfer tinaschrepfer added this to the Triage milestone Aug 6, 2024
@tinaschrepfer tinaschrepfer modified the milestones: Triage, Scheduled Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants