-
Notifications
You must be signed in to change notification settings - Fork 315
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
Psysh add ~0XXX~1 when pasting codes #636
Comments
Can you paste the output of |
Hi, I'm having the same problem. Here is the output of
Thanks. |
that sounds kind of like bracketed paste, but per your |
Thank you @bobthecow. I went to try the solution but the problem had sorted itself out. Looks like restarting the computer did the trick. I'm working on a Linux Mint 18.3 machine with Vagrant and Virtualbox (Ubuntu 18.0.4), on a Laravel project (which uses Psysh for the "artisan tinker" command). Before posting I tried halting/starting the virtual machine (to no avail). Thanks again! |
If it pops back up again, feel free to raise it :) |
I'm having problems with this. 🤔
@bobthecow what else should I try to fix it? This isn't solved by rebooting for me, I've had this problem on my laptop for a few months now. I'm not sure what's triggering it. Running Ubuntu 20.04, didn't do much in terms of config, it happens in any terminal emulator (stock gnome one, pantheon-terminal, kitty) It is fixed by turning off |
In your case, it looks like it's some confusion between Unfortunately, this likely means you can't use bracketed paste as, IIRC, it's not supported in libedit. But we can sort out why PsySH let you enable it without proper readline. I bet, somehow, you ended up with Run this in PsySH and let me know what it says?
|
🤔
Took a look at the
My entire config for PsySH is this:
Commenting out Edit: Yeah if I paste this into my terminal (two tabs) I get
I was probably following the suggestion in #254 (comment) and turning on bracketed paste but it doesn't seem to behave well 😢 |
Where are you getting it from if it's not internal?
Edit: just kidding it was internal. I misread. |
Alright, got it. As of PHP 7.4, it looks like they've implemented history with the libedit wrapper. Since, initially, the difference between our Later, when we added bracketed paste support, the logic switched on whether our readline implementation was GNUReadline. Which is the wrong thing to check, since now Libedit-based readline is also using that. I'll have a fix shortly! |
Unfortunately the fix will be that bracketed paste will not work at all for you 😢 |
That sounds about right. I think I was using 7.3 on my other machine that didn't have this issue. Thanks! Edit: does that mean that bracketed paste just won't work anymore in 7.4+? 🤔 |
No, it'll still work if you have proper readline rather than the libedit wrapper. The "fix" here is to stop letting the libedit wrapper trick PsySH into letting you enable bracketed paste support. |
Hmm. It's odd that |
As of PHP 7.4, the libedit-based readline implementation sometimes has history file support. When it does, PsySH will use the full "GNUReadline" implementation. Unfortunately, we were also using that to determine whether we could allow bracketed paste. EditLine/libedit still hasn't added support for that, so we need to explicitly check whether we're using the real readline-based readline. See #636
Yeah, it does. I think you might have to build from source to get actual readline. |
This is still an issue with To mitigate this issue, so your pasting works without ~0 XXX ~1 add this into your ~/.config/psysh/config.php: // PsySH uses readline if you have it installed, because interactive input
// is pretty awful without it. But you can explicitly disable it if you hate
// yourself or something.
//
// If readline is disabled (or unavailable) then terminal input is subject
// to the line discipline provided for TTYs by the OS, which may impose a
// maximum line size (4096 chars in GNU/Linux, for example) with larger
// lines being truncated before reaching PsySH.
'useReadline' => false,
// Enable bracketed paste support. If you use PHP built with readline
// (not libedit) and a relatively modern terminal, enable this.
'useBracketedPaste' => false, If you only use: // Enable bracketed paste support. If you use PHP built with readline
// (not libedit) and a relatively modern terminal, enable this.
'useBracketedPaste' => false, There will be still and issue with ~0 ~1 when pasting into psysh terminal. |
The fix mentioned above hasn't made it into a stable release yet. Install |
Version:
Psy Shell v0.10.4 (PHP 7.4.5 — cli)
Problem:
When pasting in psysh, it adds ~0 at the begging of string , and ~1 at the end of string
The text was updated successfully, but these errors were encountered: