copy/paste of large amount of text to terminal leads to scrambled/missing characters I work with TextMate and R over the terminal.
When pasting a lot of code (CMD+C/CMD+V, e.g. 60 lines) it sometimes happens that few characters in the code are scrambled, which then leads to error messages and wrong code execution.

For example:


  col &lt;- ifelse(...


is turning into 


  col &lt; col &lt; cse(...


or 


  onlyDF


is turning into


  oalyDF


These character-replacements seem very random and it is difficult to predict when it happens.

The problem is also described here for iterm2:
https://gitlab.com/gnachman/iterm2/issues/3160

The explanation provided there is that it is a bug in bash that can lead to buffered input to get lost due to paste speed. 

Has anyone experienced these problems and found a work-around for the native terminal app in Mac OS? (e.g. by modifying the paste speed, if that is possible in terminal)
When I need to paste a lot of text into a Terminal application window, I use the cat command to transfer the text to a file. For example, I would enter the command below before pasting the text with the ⌘+V key combination.

cat &gt;myfile.txt


When finished pasting text, enter the control+D key combination. This will terminate the cat command.


  Note: The control+D key combination must be entered at the beginning of a line. If not at the beginning of a line after pasting the text, then press the return key before entering the control+D key combination.