Pasting text with newline at shell prompt does not execute command

3,225 views
Skip to first unread message

Mark Montague

unread,
Feb 20, 2021, 11:54:12 AM2/20/21
to iterm2-discuss
I've been running the nightly build for years (currently Build 3.4.20210218-nightly on macOS 11.2.1).  A few weeks ago, pasting text with a newline at a shell prompt started pasting the newline but not executing the command.  The full line is pasted, the cursor moves down to the next line, I have to press Return to get the command to execute.  This problem did not start happening until a few weeks ago.

If I go to Session -> Terminal State and either turn off Paste Bracketing or do a Reset, this solves the problem but only for the next command.  After the next command, Paste Bracketing is immediately turned back on and the problem exists.

I have Shell Integration enabled, but disabling it does not affect the problem.

Under Preferences -> General -> Selection I have "Copied text includes trailing newline" turned on.  Under Edit -> Paste Special I have "Warn before multi-line paste" and "Warn before pasting one line ending in a newline at shell prompt" both turned off.

I have iTerm2 configured to start bash as my shell in all sessions, but my account still has zsh as its shell.  Renaming both ~/.bashrc and ~/.bash_profile to get a default bash config does not help.  The same problem occurs with zsh.  However, the pasting-command-with-newline problem does NOT occur when I run tcsh.

Any ideas why pasting text with a newline doesn't execute the command, or why Paste Bracketing keeps turning itself on?
 

George Nachman

unread,
Feb 22, 2021, 1:51:31 AM2/22/21
to iterm2-...@googlegroups.com
Zsh seems to enable bracketed paste by default. You can turn it off with:

unset zle_bracketed_paste



--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/7af66e89-32a9-4c59-8d81-fa2fed77a666n%40googlegroups.com.

Mark Montague

unread,
Feb 22, 2021, 8:30:22 AM2/22/21
to iterm2-discuss
Thanks!  As you pointed out, this is a shell problem rather than an iTerm2 one.

Using what you posted for zsh, I was able to find the answer for bash and the readline library:

bind 'set enable-bracketed-paste off'

or add the following to ~/.inputrc

set enable-bracketed-paste off
Reply all
Reply to author
Forward
0 new messages