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

Investigate using line2byte for highlighting #21

Open
isovector opened this issue Feb 1, 2022 · 2 comments
Open

Investigate using line2byte for highlighting #21

isovector opened this issue Feb 1, 2022 · 2 comments
Labels

Comments

@isovector
Copy link
Collaborator

Allegedly line2byte in vim does the line offsetting that we'd like.

@isovector isovector added the vim label Feb 17, 2022
@isovector
Copy link
Collaborator Author

isovector commented Feb 18, 2022

Also, the byteidx function seems to do the right translation given a string. Furthermore, byte2line is almost exactly the buffer lookup we want.

@isovector
Copy link
Collaborator Author

I think the technique here is to use byte2line to get the line, call line2byte on that, subtract the two to get the line offset, and then use byteidx on that to get the actual BufferOffset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant