title: Paste into SSH terminal capitalizes last character and doesn't allow me to edit it
body: <p>I'm running Terminal on my Mac and ssh'ing into a Linux host.  I've had 2 issues around copying and pasting text into my Terminal:</p>
  
  <ol>
  <li>When I'm just running local Terminal commands on my Mac (not though ssh), I sometimes get weird characters around text that I paste, like <code>00~pastedtext01~</code>.  I googled around and found out that this was apparently due to "bracketed paste".  I was able to fix this problem by running the command <code>printf '\e[?2004l'</code> whenever it happens.</li>
  <li>When I ssh into my Linux host, when I paste text it will often capitalize the last character of whatever I'm pasting, and the cursor will turn gray and I won't be able to type additional characters or delete characters from whatever I pasted.  My only two options at that point are to either ^C to break onto the next line without running the command, or hit enter and run the messed up command.  It doesn't happen 100% of the time.  If I copy something and then repeatedly paste it into the shell, I'll see this issue occur about 90% of the time.  I have no idea why it's apparently non-deterministic like this.  I thought this might also be due to "bracketed paste" issues, but no matter how many times I run the commands <code>printf '\e[?2004l'</code> and <code>set enable-bracketed-paste off</code>, the issue persists.  It even persists when I exit and re-ssh to the host, so I know it's not due to running any program like vim, since the problem still happens even immediately after I've ssh'ed into the host.  Can someone please help???  This is killing my productivity!</li>
  </ol>
  
  <p>Here's what a paste with this issue looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/IZDfK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IZDfK.png" alt="Paste with issue"></a></p>
  
  <p>I'm aware that other questions have been asked along these lines, like <a href="https://unix.stackexchange.com/questions/379653/paste-has-odd-behavior-in-shell">this one</a> from Stack Exchange, but none of the answers on any of these posts have worked for me, so I think my problem may be slightly different than those...</p>