I was having the same issue even if all the settings was okay. The only issue I found out was comments. If your piece of code (to be copied and pasted) starts with any commented line, it will only paste the first line correctly and rest of the lines will be pasted at the start