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: goto_file_impl look around in chars instead of bytes #12677

Closed

Conversation

magackame
Copy link
Contributor

Fixes one more failure case missed in #12673.

Do lookaround in chars instead of bytes to prevent incorrect slicing at a random offset. Then convert to bytes for use with regex byte ranges.

@the-mikedavis
Copy link
Member

This looks correct but I'd prefer to do byte indexing for this instead of character indexing. Ropey v2 will drop character indexing and only allow byte indexing, so this is a good opportunity to write some helper functions to solve cases like this. In this case we need a helper that shifts a byte index to its closest character boundary like str::floor_char_boundary/str::ceil_char_boundary from std. I've pushed these changes in aac0ce5...4919058

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.

2 participants