In the latest versions of terminals (gnome-terminal, mate-terminal, konsole, xfce4-terminal, xterm, etc), programs seem aware of whether some text is from paste or keyboard input. Specifically:
- If I paste something into bash, the pasted text would be highlighted, and newlines don't trigger command execution.
- If I paste something into vim, the text would be inserted into the cursor position, even if it wasn't in insert mode.
What is this feature called? How do I imitate this behavior in my own program? Could I temporarily disable this feature in these programs?
Related: Why is Terminal automatically executing my command after pasting text?