This answer is not the most-specific for the user's question Please see my 2nd answer. I am leaving this here because it addresses the more general issue.
Per the comments to your original post, you need (1) a terminal emulator which supports bracketed paste and (2) corresponding support for whatever is running in the terminal, ie, vim
, bash
, zsh
. Terminal emulators supporting bracketed paste (list to be updated based on comments to this post):
xterm
- since ??
gnome-terminal
- since ??
putty
- since 0.63 (2013-08-06 release date)
Applications supporting bracketed mode:
For bash
, StéphaneChazelas has put together a shell script to facilitate the detection of that mode and take appropriate action.
A more specific answer -- preventing lines from getting chopped off -- is unanswerable without knowing about the unix program that is running when you hit paste.
A clipboard manager maybe what you need.
sleep 999999
then do the paste if it looks ok. the sleep command does not read the lines and they are discarded when you pressctrl+c
. – Skaperen May 11 '15 at 12:22bash
will have support for bracketed paste,zsh
already has via 3rd party plugin. – Stéphane Chazelas May 11 '15 at 12:32I suppose the idea is that the terminal detects a paste and precedes the content with a "bracket" -- some sort of escape sequence -- that you trap with the WNCH handler and take appropriate action.
– Otheus May 11 '15 at 13:30printf '\e[?2004h'
in most xterm-like terminal emulators enables a bracketed-paste mode where the terminal brackets the pasted text so that applications can detect where the paste start and where it ends. xterm also support another mode with\e[?2005h
where all pasted characters are prefixed with^V
(understood by many applications and the tty line discipline aslitteral-next
). – Stéphane Chazelas May 11 '15 at 13:44