Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Fix going into visual mode when filling out snippets with adjacent placeholders etc

Open abvkash opened this issue 1 year ago • 1 comments

What this PR does / why we need it:

Fixes going into visual mode on certain placeholders when you fill out vscode user snippets. Particularly this occurs when the placeholders are placed adjacent to each other (not seperated by a character, see Issue #9236), or when the snippet starts from a placeholder (see Issues #5969, #7068).

Note on the fix:

I noticed that in each of these placeholder cases where the cursor goes into visual mode, isSnippetSelectionChange() inside ModeHandler.handleSelectionChange() returns false even though it is a snippet selection.

Modifying isSnippetSelectionChange() to only consider the previous cursors that represent a selection (c.start and c.stop are not equal) when comparing with e.selections, seems to have fixed the issue.

Which issue(s) this PR fixes

Fixes #9236, #7068, #6465, #5969

Special notes for your reviewer:

abvkash avatar Sep 03 '24 09:09 abvkash