-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
readline.line automatically escapes input #45950
Comments
Can you post a test case? I'm fairly sure no escaping takes place inside the readline module; you're probably looking at something that was ran through e.g. |
I don't have a Windows machine at hand but I can't reproduce on Linux or macOS. Maybe it's Windows-specific or maybe it's something your debugger does? I suppose it could be related to the fact Windows uses Something you can test is whether |
Maybe you meant Both The test is "test\ntest" input and then Ctrl-C. |
What I think is making confusion here is the backslash usage, because it's an escape character. With that in mind, when in some string you have I ran the following code on both Windows and Linux in VS Code terminal with input
and the outputs were identical:
On both OSs in the debugger, I saw |
Thanks for the tests Stefan.
Exactly.
Yes, it prints "\n" (which could be ok for printing, but not always for using line in code) because it is escaped by the library. But Ben said that there should not be escaping:
Now I think that what is missing is if readline module intent is to escape or not. |
Hi @StefanStojanovic , I copy your code in my Win 10 and the result is The first attempt was "test\ntest" + I am noob here, and my case is using Or another way to implement that is invoking vim editor using other node functions, and read what I wrote in that temporary vim txt file? I just have this idea, and I guess this way is too complicated for me now. |
Sorry, I guess I found the answer to this. But I am still curious about the code here, if I press |
Version
18.12.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
readline
What steps will reproduce the bug?
Use readline and access its
line
variable.rl.line
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
I see that if I input
\n
, then it is automatically escaped with\\n
, is it possible to disable this behavior and get\n
?Additional information
I am not sure if this behavior is something wanted. If so, then I am asking if there is an alternative to get the non-escaped character. (
\n
)The text was updated successfully, but these errors were encountered: