Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • The script in there doesn't detect bracketed paste, it is a perl script that emulates a 3rd form of bracketed paste which doesn't require support in the application other than the application needs to understand ^V as litteral-next (that script would actually answer this question though would probably need improved, it was just a PoC). Commented May 12, 2015 at 9:16
  • @StéphaneChazelas feel free to edit/improve my post. :) "The application needs to understand ^V as literal-next. But how does the ^V get into the input stream of the application? Commented May 12, 2015 at 12:34
  • It does get it if the inner tty device is not in icanon mode (like bash readline's prompt will see it (and will treat is as literal-next)). If in icanon mode, the line discipline of that inner tty device will strip it (as long as the lnext character is ^V), just like when you type Ctrl-V X manually.. Commented May 12, 2015 at 12:38
  • 1
    If not using that script, nothing inserts ^V unless you use xterm's quoted paste mode (enabled by sending \e[?2005h). That perl script could be adapted so that it removes all but the first line in a multi-line paste (though not reliably for large pastes), but as it is already, since it quotes the newline for readline (as if you had pressed Ctrl-V Ctrl-J), it prevents the lines from being executed (they're just added to the editing buffer and you still need to press Enter to execute them). Commented May 12, 2015 at 14:07
  • 5
    What second answer? Commented Sep 16, 2015 at 0:53