-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: make countlines count final non-empty line even without EOL #25845
Conversation
We might want to have some way of preserving the old behavior. One way would be to consider the default |
When would you ever want |
Note that if we didn't allow specification of what constitutes end-of-line this would be straightforward since it seems pretty clear that |
In the rare cases (if any) where someone needs the old behavior, can't they easily get this via: function countnontrailing(io, eol)
n = countlines(io)
return n == 0 ? n : n - (read(skip(seekend(io),-1), UInt8) != eol)
end That would probably be lot more efficient than using a regex. |
I feel like we could at some point have a
so 👍 on this change. |
Triage is in favor of accepting this as-is (I agree). |
Probably |
This is a breaking change that makes
countlines
agree with the length ofeachline
andreadlines
when the last non-empty line does not end with EOL.See the discussion on discourse.