Skip to content

Conversation

@TheLeoP
Copy link

@TheLeoP TheLeoP commented Nov 10, 2025

Fixes #827 . The changes are similar to the ones in #812 , but they are different from the function mentioned in a comment of that PR (#812 (comment)) because said function assumes that the range returned is end-inclusive, while this plugin currently is treating the range as end_exclusive.

This bug was surfaced by #687 (because and end_row, end_col pair like 4, 0 becomes 4, -1 after the change), but this wasn't working properly before #687 either. The behavior before that PR was to also select the first character of the next line (so, one character after the newline).

@TheLeoP
Copy link
Author

TheLeoP commented Nov 11, 2025

Also fixes #809 and #793

@kiyoon
Copy link
Collaborator

kiyoon commented Nov 11, 2025

If this is similar to the #812, what makes this PR different from that?

@Ti64CLi
Copy link

Ti64CLi commented Nov 11, 2025

I'd also like to point out that it doesn't fix goto_*_end moves. They still throw an col out of range error.
I tried something with this commit : Ti64CLi@3b633e3
It seems to fix the error with goto_next_end, but goto_previous_end just doesn't do anything, I don't know if it is introduced by that commit or not.

@TheLeoP
Copy link
Author

TheLeoP commented Nov 11, 2025

I'd also like to point out that it doesn't fix goto_*_end moves.

It now does @Ti64CLi

If this is similar to the #812, what makes this PR different from that?

This PR addresses both select and move modules. This PR doesn't use a single function to handle both (because AFAIU ranges are interpreted differently in both). This PR has a couple of comments explaining why the range transformation is needed for end_row, 0 ranges and why it has to be done before the adjustment for inclusive/exclusive ranges. This PR doesn't blindly add a math.max check, because end_col will never be 0 by that point in the code. This PR is also explicit about which issues it solves.

@Ti64CLi
Copy link

Ti64CLi commented Nov 11, 2025

It now does @Ti64CLi

Thanks a lot for that !

@kiyoon kiyoon merged commit 06c00bc into nvim-treesitter:main Nov 12, 2025
3 checks passed
@kiyoon
Copy link
Collaborator

kiyoon commented Nov 12, 2025

Thank you!

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