I have noticed that when pasting into a terminal emulator, both on macOS (using Terminal.app or iTerm2.app) or in Linux (using urxvt) sometimes I get extra characters.
The characters are always the same - before the pasted text I get ^[[200~
(with the ^[
highlighted) and after the pasted text an extra ~
. If I cancel and paste again then it is pasted correctly.
For example here I tried to paste git clone https://git.qemu.org/git/qemu.git
copied from their webpage into iTerm2 with with ⌘v. I cancelled with ctrlc and (without recopying) pasted again with ⌘v and it was OK.
This is certainly not always but several times a day and I've not managed to narrow down what causes it and can't reliably recreate it.
- the text can come from anywhere (website, text document, copied from the terminal itself).
- position of cursor when I copy doesn't seem to make a difference (I don't think I'm copying the cursor)
- position of mouse doesn't seem to make a difference.
What are these ^[[200~
~
characters and how do I get rid of them? Surely they must stand for something specific as they are always the same and appear on both macOS and Linux.