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 line_end_char_index() documentation #10658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pantos9000
Copy link

@pantos9000 pantos9000 commented May 2, 2024

Heyhey,

I came across said function - helix_core::line_ending::line_end_char_index(). Its documentation states:

Returns the char index of the end of the given line, not including its line ending.

But e.g. for "a\nb" it returns 1. But according to the documentation, I would expect it to return 0, the index of the last non-newline char, a.

Come to think of it - if the function would return the index of the last non-newline char, it should probably return an Option, as a line might contain nothing except the newline character...

So my guess is that the documentation is outdated, or that my understanding of char indices is fundamentally wrong.

If the second is the case (might very well be), it would be nice to somehow adjust the doc to be more clear.

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.

None yet

1 participant