Pasting into terminal prepends 00~ and appends 01~ to the pasted content
I have seen at least one other report of this issue (iterm2/issues/5311), but I am posting again because that issue's solution was to reset the terminal, disabling paste bracketing which may get stuck on. For me this did not fix the issue consistently as it persisted across multiple restarts of the app and multiple reboots of my MacBook Pro.
- iTerm2 version: 3.3.0beta13
- OS version: 10.14.5 (18F132)
Detailed steps to reproduce the problem:
- Copy text from another application
- Paste text into iTerm
Unfortunately this was happening every time I pasted, across reboots and app restarts, for three days which finally got me motivated to file this bug report. I closed iTerm to follow the instructions for creating a debug log and...now it has stopped. Previously (over the last couple years, prior to the "every time" I was experiencing with beta13) I would get it very infrequently and not in any way I have been able to reproduce so I didn't bother with a bug report, but almost 100% of the time when it did happen it would be in either of the following two circumstances:
- Open three panes in a single tab.
- In each pane, first type the command
cd ~/Source/project && source env/bin/activate
to activate my python virtual environment. - One pane has
watch docker-compose ps
running, one has a dev server for my Django project running (docker-compose run --rm --service-ports django python3 manage.py serve 0.0.0.0
), and the third is just a prompt waiting for commands. I would need to kill the dev server container (due to an unrelated [?] bug possibly in one of Django/iPython/Werkzeug/ipdb that broke auto-reload and brokectrl+c
). - In order to do this I would double-click the name of the Django container in the output of
watch
from the first pane, selecting the text, copy this text with⌘+c
, switch to the third pane and typedocker kill
(with a trailing space) then paste the name of the container I copied form the first pane with⌘+v
. - Intermittently, this sequence of actions would paste the container name with
00~
at the beginning, and01~
at the end.
Also:
- In the same three-pane setup, I would run the project's unit tests instead of starting its dev server (
docker-compose run --rm django python3 manage.py test --noinput
). - In the case of a test failure, the unit tests framework (
nose
) would output a list of tests that failed along with their python paths when the suite finished. - I would select the python path of the failed test and copy it, then go back to the waiting prompt and append that path to the previous command so I could run that single test in isolation.
- Intermittently, the python path for that test would have
~00
prepended, and01~
appended.
With the latest beta13, this started happening regardless of the source of the copied text. And until I started writing out this bug report, it was happening in beta13 every time. Now it seems to have reverted back to only being intermittent. In the previous bug report (5311) it says this may be caused when an app crashes, getting the terminal stuck in bracketed paste mode, but I would experience this in a fresh window after running a command that exited successfully as well. Also, when my unit tests would crash those crashes are captured as a unit test failure not an app crash, and the test suite would complete and exit successfully. In some cases I would restart the terminal and run the same test command, resulting in the same failures, but copying/pasting the path that time would work just fine without the extra characters.
I have also experienced this where the app that crashed (the Django crash in my first example) would be in one pane, but the paste bug would then begin happening in all panes (not sure if it was also across tabs, though).
The apps I've pasted text from when encountering this error most recently include iTerm itself (as in my examples), PyCharm (Java), Quiver (a Mac-native personal wiki/notes app, written in Obj-C I believe), Firefox, Chrome, OmniFocus, Signal, Xcode, BBEdit, Sublime Text, VSCode...doesn't seem to discriminate on sources or the source app's architecture.
What happened: the text that gets pasted is 00~docker volume rm $(docker volume ls -qf dangling=true)01~
What should have happened: the text that gets pasted should be docker volume rm $(docker volume ls -qf dangling=true)
Preferences file: com.googlecode.iterm2.plist
Not sure how useful a debug log would be for this now, as I'd have to just enable the debug logging and leave it running with multiple panes until I have the issue again, and I'm not sure I'd be able to trim enough of the useless stuff out of the debug log between opening the tab/pane and encountering the error. I am willing to try, however, if you would like.