Sample Header Ad - 728x90

How do I distinguish paste and input in terminals?

1 vote
1 answer
57 views
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: https://unix.stackexchange.com/q/230678/95685
Asked by user23013 (1153 rep)
Dec 15, 2024, 08:19 AM
Last activity: Dec 15, 2024, 09:48 AM