You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just tested my Node.js REPL in bun, and it works fine except paste bracket mode.
To enable the mode you use ?2004h ANSI escape code:
process.stdout.write('\x1b[?2004h');
and then you will get \x1b\[201~ and \x1b\[200~ ANSI escapes around the pasted text.
What is the feature you are proposing to solve the problem?
It solves the issue with auto indent inside REPL, if you create auto-indent you do this in line by line basis, and you don't know if the code already have indentation (when you copy paste the code often the code is formatted).
The auto indent should only happen when you press enter, but the REPL don't differentiate between enter and line from copy pasted. Except when you use paste bracket mode.
NOTE: I've added this feature to Node.js, if you're interested I can see if I can contribute and add same feature to Bun.
Node.js require this piece of code for the escape appear in the output:
But bun don't behave like Node.js, when you paste, the text is wrapped in ~, but you can't distinguish that from text that use ~, you need an escape sequence.
What alternatives have you considered?
There are no alternatives, the code without this feature is a mess, and it doesn't work correctly.
The text was updated successfully, but these errors were encountered:
Fwiw the repl in current state is a npm package that appears to be inactive https://github.com/jhmaster2000/bun-repl, there are plans to rewrite in native zig sometime though.
What is the problem this feature would solve?
I just tested my Node.js REPL in bun, and it works fine except paste bracket mode.
To enable the mode you use
?2004h
ANSI escape code:and then you will get
\x1b\[201~
and\x1b\[200~
ANSI escapes around the pasted text.What is the feature you are proposing to solve the problem?
It solves the issue with auto indent inside REPL, if you create auto-indent you do this in line by line basis, and you don't know if the code already have indentation (when you copy paste the code often the code is formatted).
The auto indent should only happen when you press enter, but the REPL don't differentiate between enter and line from copy pasted. Except when you use paste bracket mode.
NOTE: I've added this feature to Node.js, if you're interested I can see if I can contribute and add same feature to Bun.
Node.js require this piece of code for the escape appear in the output:
Now I think this is not a good API, the code should always be added when in bracket mode, but this is how it was implemented.
If you're interested, I've written an article about this on my blog:
I just noticed that the code is there:
https://github.com/oven-sh/bun/blob/main/src/js/node/readline.ts#L466-L472
But bun don't behave like Node.js, when you paste, the text is wrapped in
~
, but you can't distinguish that from text that use~
, you need an escape sequence.What alternatives have you considered?
There are no alternatives, the code without this feature is a mess, and it doesn't work correctly.
The text was updated successfully, but these errors were encountered: