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

Fix off-by-one in select symbol references #7132

Merged

Conversation

mtoohey31
Copy link
Contributor

This merge request fixes an off-by-one error in select_references_to_symbol_under_cursor.

When finding the range which contains the head of the current primary selection (so that this range will be the new primary selection), using the head field of the primary selection leads to the correct range being missed when head > anchor and the cursor is on the final character of the range, since Range::contains's pos parameter seems to refer to the position of a character since it is non-inclusive. Using the cursor method fixes this since it returns the position of the character under the cursor.

Copy link
Member

@dead10ck dead10ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for the fix!

Copy link
Member

@pascalkuthe pascalkuthe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks!

@pascalkuthe pascalkuthe merged commit 207829e into helix-editor:master May 25, 2023
@mtoohey31 mtoohey31 deleted the fix/symbol-references-off-by-one branch May 25, 2023 13:00
aotarola pushed a commit to aotarola/helix that referenced this pull request May 28, 2023
aotarola pushed a commit to aotarola/helix that referenced this pull request May 28, 2023
Triton171 pushed a commit to Triton171/helix that referenced this pull request Jun 18, 2023
wes-adams pushed a commit to wes-adams/helix that referenced this pull request Jul 4, 2023
mtoohey31 added a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 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

Successfully merging this pull request may close these issues.

3 participants