-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Pasting in multiline code terminal regression #25186
Comments
Oh I can't reproduce... Could this is a differences in the shells? |
BTW this is on Windows just using the regular cmd .... |
Or a difference in terminals. cmd is notoriously the worst "terminal" around... |
I tried conemu (and powershell) and is reproducible on all of them... |
Ok, seems to be Windows specific then. I wonder if it has something to do with |
This is the auto-indent feature. On newer terminal emulators, "paste" is a special atomic action, so we can disable reformatting (among other issues). The Windows terminal doesn't have that feature. |
Please don't close issues that are clearly a huge usability problem. |
If the auto-indent feature cannot be properly supported on some terminals then we should turn it off on those terminals. The question is how to detect if we're running in such a terminal or not. |
Or you can just type If you'd like to reproduce this on your terminal, either type very, very quickly
|
We're not going to have the official "solution" to be typing some weird shit on Windows. |
There's nothing Windows-specific about it, you can test it out by doing the same on any system :) |
Here in VSCode: I'm guessing this is #22948. @rfourquet |
@rfourquet, this bug was introduced by your changes. Do you have any ideas for the way forward here, short of reverting those features? |
No I don't see what to do here, except disable the feature on Windows (if the bug is Windows specific and concerns every/most Windows platforms) or introduce a REPL option to disable the feature (I could swear this option already existed!) and document this problem together with the way to change the option. I will make a first PR to introduce the option anyway. |
Seems like xterm.js added support in xtermjs/xterm.js#1097. Since the windows |
Also, since windows now has |
Being able to fix this to work properly universally would be great because the feature is really nice. |
It’s not in VT100. Conhost.exe would need to implement this functionality - I’m not aware of its existence currently. |
Well, |
I'm slightly confused how the existence of a javascript implementation of xterm is relevant to the Windows Console kernel driver or its GUI wrapper (conhost). I agree it would be nice if Microsoft implements this, but I doubt they read this issue tracker. |
It's not. There were two concerns raised in this issue
|
Or rather https://github.com/microsoft/console is probably the right place |
As of libuv/libuv@58ccfd4 |
since this is so annoying, the workaround is to set |
Is there any way we can detect terminals where this is likely to be broken and turn auto indent off? |
On some Windows terminals, pasting is not recognized as such. This happens also with tmux' builtin paste. In those cases, auto-indent is better disabled, as we want to preserve the original indentation of the code being pasted. This fix is quite a hack, but seems to work: using time(), if the next character after a newline is being inserted very fast, assume this was with paste, and cancel the insertion of the spaces done by auto-indent. I couldn't insert two characters in a raw within less than about 0.03 or 0.02 seconds, so the threshold for "very fast" is set to 0.0005, but this is an option which can changed.
On some Windows terminals, pasting is not recognized as such. This happens also with tmux' builtin paste. In those cases, auto-indent is better disabled, as we want to preserve the original indentation of the code being pasted. This fix is quite a hack, but seems to work: using time(), if the next character after a newline is being inserted very fast, assume this was with paste, and cancel the insertion of the spaces done by auto-indent. I couldn't insert two characters in a raw within less than about 0.03 or 0.02 seconds, so the threshold for "very fast" is set to 0.0005, but this is an option which can changed.
On some Windows terminals, pasting is not recognized as such. This happens also with tmux' builtin paste. In those cases, auto-indent is better disabled, as we want to preserve the original indentation of the code being pasted. This fix is quite a hack, but seems to work: using time(), if the next character after a newline is being inserted very fast, assume this was with paste, and cancel the insertion of the spaces done by auto-indent. I couldn't insert two characters in a raw within less than about 0.03 or 0.02 seconds, so the threshold for "very fast" is set to 0.0005, but this is an option which can changed.
On 0.7 copy pasting the following
Results in
compare to 0.6
This is especially/annoying/noticeable for larger blocks
The text was updated successfully, but these errors were encountered: