-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 paste bracket mode #45213
Comments
Aditional notesA quick intro to how paste brackets work: You print this escape sequence:
and terminal will include If your REPL is a programming language and you auto-indent the user input when copy-paste long code you can skip the auto-indentation if the input text is in paste brackets. I have an application when I was testing this but the line event removes the escape sequence There is a need for some kind of API (like a flag) to turn on paste brackets and send it with a line event so it can be processed. It can even be always sent since to turn this on you need to write the Without this, you need to use hacks to fix the auto-indentation, but I was not able to create a proper hack for my REPL. |
@jcubic seems like a reasonable thing to support. PR welcome. |
I was looking at the code for readline and I have no idea where ANSI escapes codes are removed. |
Probably emitKeys() in lib/internal/readline/utils.js. |
@bnoordhuis I will try to see what I can do. One question can you build Node and run it without installation, I don't want to mess up NVM and my local Node installation (I use Fedora GNU/Linux). Edit: |
@jcubic yes, the binary ends up in out/Release and you can run it from there. |
The paste bracket mode allow REPL to have auto-indentation that is handled differently when user copy paste the code from the clipboard and the code already have indantation.
I've created a PR, it was testing it with my REPL, and it works much better. I can have a proper auto-indentation without any effort. I can also update documentation for Node 20 if the feature will be included with that version. |
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation.
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation.
@bnoordhuis how long it takes for CI/CD to run? I'm waiting 3 weeks for triggering the GitHub action. |
@jcubic can you link me to the pull request? |
Yes, sorry it seems that only commit is linked: #47150 |
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs#47150 Fixes: nodejs#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs#47150 Fixes: nodejs#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs#47150 Fixes: nodejs#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: #47150 Fixes: #45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs#47150 Fixes: nodejs#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs#47150 Fixes: nodejs#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: #47150 Fixes: #45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: #47150 Fixes: #45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: #47150 Fixes: #45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs/node#47150 Fixes: nodejs/node#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
The paste bracket mode allows REPL to have auto-indentation that is handled differently when the user copy-pastes the code from the clipboard and the code already has an indentation. PR-URL: nodejs/node#47150 Fixes: nodejs/node#45213 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
What is the problem this feature will solve?
Found recently about paste bracket mode that would help solve the issue with auto-indentation in NodeJS-based REPLs.
I've asked on StackOveflow but no one answered because I think no one uses such a feature, because no one knows that this exists.
How to use terminal bracket paste mode in Nodejs REPL?
You can read about paste bracket mode on Wikipedia.
What is the feature you are proposing to solve the problem?
Add paste bracket mode to NodeJS readline.
What alternatives have you considered?
The alternatives are flaky hacks.
The text was updated successfully, but these errors were encountered: