-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Feature request: Inform the "line" event on a Readline interface of the type of end-of-line input #7952
Comments
It is not a reliable approach unless you read the whole file first.
|
This is good idea, I think. It would definitely need to be line-by-line because a single doc could contain a mix. The key challenge with implementing this is that the current impl does not record the line-ending currently. It wouldn't be that difficult to add in tho. Interested in doing a PR? :-) |
I'd love to. I'll give it a try but it's quite possible that I'll just fail to understand the bigger picture of the project. Got a pretty promising looks on the readline.js file though so let's see what comes around, :) |
@loilo Cool! If there’s anything you need or you’d like to ask, you can do that here or e.g. in #node-dev on Freenode! |
+1 to what @addaleax said :-) If you get stuck or need someone to bounce ideas off of, just let one of us know! |
I'd love to do a PR, please let me know if I can help :) |
I think @loilo is already working on something? :) |
@JungMinu Are you still planning on doing this? If not, should we unassign it so someone else can pick it up? |
ping @JungMinu |
pass separator as a parameter to the callback alongwith line to inform line event about separator used to break lines fixes: nodejs#7952 (comment)
I just planned on implementing this I came to a point where it's difficult to identify the actual end-of-line. Readline just receives arbitrary chunks and we have to delay emitting the last line in case the chunk contains a carriage return at the end of it. Otherwise it's not possible to guarantee that it's the correct line ending. We also have the I am for these reasons not sure anymore if we should really implement this. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
I was using the
Readline
module to rewrite a file line by line. While doing that I noticed that I had no idea which end-of-line (\r
,\n
,\r\n
) caused the line break so I could not reassemble the file exactly as it was.Of course I could detect the first EOL and then just use that for everything but in most cases I want to leave the line untouched anyway. Wouldn't it be a good idea to pass the found EOL string as a second argument to the callback of a
line
event emitted by areadline.Interface
?The text was updated successfully, but these errors were encountered: