edit: 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

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 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.

Actually if you copy/paste a group of these characters, only the first one is wrong:

Image

Unless it’s [ in which case it crashes the editor.