Bug when copy/cut/paste some special characters
When copying/cutting special characters like @, [, ], {, } then pasting them, the editor will print other characters or crash.
Ex:
- copy/paste
@will not work - copy/paste
[will crash the editor. Mouse and special keys will print strange characters - copy/paste
],{,}will print different characters
Confirmed on my end too.
Copy [ and then pasting it will make a lot of things insert other things, some I noticed.
- mouse 1
- mouse 2
- scroll wheel up
- scroll wheel down
- scroll wheel press
- backspace
- insert
- home
- delete
- end
- home
- pg up
- pg down
- arrow keys
- any Alt +
- any Ctrl +
Only copying the character is fine. It's after it's been pasted that the behavior occurs.
I've tried this and couldn't reproduce it in Windows Terminal when simply trying to copy/paste those 5 characters. What terminal are you using?
I've tried this and couldn't reproduce it in Windows Terminal when simply trying to copy/paste those 5 characters. What terminal are you using?
Windows Terminal Version: 1.22.11141.0
I tested with pwsh 7.5.1 and cmd. Same result in both cases.
Window 11
Windows Terminal Version: 1.22.11141.0
(Also using clink, if that's relevant)
Also tried a on a Window 10 computer, same Terminal version as before, still using Clink. Still broken.
Edit: Tried in powershell (which isn't using clink) and it still happens.
Additional characters I have found that doesn't copy paste properly: \, |, ~
Here I wrote \, I then copied it and pasted it. I can see in my clipboard that it's still a \
Here I wrote [ copied it, made a new line, then pasted it. I then did the following with a new line after each: Mouse1, mouse2, ctr+s, ctrl+c, ctrl+v, arrow right, down, left, up
With [ copied and pasted I can no longer do anything as even pressing "File" will insert the characters.
Copy pasting multiple of the characters at the same time only makes the first be pasted as something weird.
Line I copy followed by a paste.
Actually if you copy/paste a group of these characters, only the first one is wrong:
Unless it's [ in which case it crashes the editor.
To make this issue even better [ doesn't crash the editor for me. Except that we get the same behavior.
Edit: WSL isn't install on my computer.
I found that it won't crash on my end either (both in WSL and not) (I can even copy and paste '[' fine)
Lol for me still crashing even in WSL ubuntu:
FYI, my ubuntu profile in Windows terminal is using the font "BlexMono"
I tried on my end. I don't have any problems.
I wonder if it has to do with the selected font. I just realized that it's using my terminal font that supports ligatures and it doesn't have the problem. I'm using Window Terminal 1.22.11141.0
Ok, I just tried in Gnome term Version 3.44.0 with font "BlexMono Nerd Font Mono" and I could not reproduce. I'll try again tomorrow on WSL with another font and will update this issue.
Edit: I tried with "Cascadia Mono" and I have the same issue. I installed the terminal with winget so I tried with the .exe from github release and it's the same as well. Not sure what else could be different :-\
Tried a lot of different fonts. Including the default(?) "Cascadia Mono" but the problem persist.
I continue to be unable to reproduce the issue. I tried different keyboard layouts and so on as well.
If anyone has this issue on one of their PCs but not on another, we could check if there's any difference between them.
I tested alacritty in Window and could not reproduce the issue.
Using xterm in WSL is working as well:
The problem looks to be caused by Windows Terminal. I don't understand why, I tried other fonts, I tried with WSL, CMD and PWSH, all have the same issue. Also tried changing various settings, but nothing. Any tips how I could troubleshoot this? Thanks!
I can echo this. I have tried the cygwin terminal and it works as expected. Tried in the standalone gitbash and it worked as expected, tried in gitbash inside of Windows Terminal and the weird behavior is there.
I tried to remove my terminal folder at %LOCALAPPDATA%\Packages to reset it and it still behaves like this.
Downloading the latest zip from windows/terminal here on github still exhibits the behavior.
What I found so far is that when I paste [0], there are two calls to sys::read_stdin. The first returns ESC [200~ and the second ESC 0] ESC [201~ So, there is an ESC (ASCII 27) where the [ should be.
Is that helpful? (This stuff is quite beyond my knowledge...)
I think this is just a Windows Terminal bug: https://github.com/microsoft/terminal/issues/18579
I think it only occurs if you're pasting with a Ctrl keyboard shortcut, and only effects certain keyboard layouts (I can reproduce it with a German layout). I think you also need to have started the session with that keyboard layout already selected, e.g. it won't trigger if you start with an English layout and then switch to German.
Yes, SHIFT-INSERT or inserting via the menu works fine. Only CTRL-V messes it up.
I'm using a Swiss layout...
Weird.
Oh, interesting. I tried it with a Russian layout (due to that other Windows Terminal keyboard layout bug), and it didn't reproduce the issue for me. With a German layout on the other hand, pasting a [ results in an immediate freeze of the application. It never occurred to me to test other layouts...