On Sat, Feb 08, 2025 at 02:39:19PM -0500, Paul Fox wrote:
> Resurrecting an old thread, because I've once again been bitten by
> the bracketed paste idiocy.
> 
> thomas wrote:
>  > On Mon, Oct 28, 2024 at 04:57:43PM +0100, Steffen Nurpmeso wrote:
>  > > Chris Green wrote:
>  > >  |> I have a peculiar problem when pasting text into vile.
>  ...
>  > > 
>  > > Does vile support bracketed paste mode?  Doing a
>  > 
>  > That could be a problem, e.g., if one's running some shell (or script)
>  > which turns it on and doesn't bother to turn it off when running commands.
> 
> Several times recently some shell or application on one of the many
> hosts I ssh to has enabled bracketed paste, and it's usually just
> before I start composing an email message into which I want to paste
> text, and I'm prevent from making any progress at all because the
> brackets make vile go bonkers and trash my To line until I figure out
> how to get a copy of the paste from some other source (usually using
> "cat > file" as an intermediary.
> 
> And figuring out who enabled bracketed paste?  Impossible.

:-)
 
> All I want is for it to go away, forever.  The alternative is that every
> program I run on every machine I use implements it perfectly.  And we know
> how likely that is.
> 
> So:  can vile please either ignore the paste brackets, or implement them?

Bracketed paste is basically two function-keys separated by the pasted text.

Quoting from terminfo.src (\E is the escape character, commas delimit):
 
bracketed+paste|xterm bracketed paste,
        BD=\E[?2004l, BE=\E[?2004h, PE=\E[201~, PS=\E[200~,

# BE enables bracketed paste
# BD disables bracketed paste
# PS is sent before the pasted text
# PE is sent after the pasted text

:describe-bindings seems to show something useful for this purpose:

"do-nothing"                    ^Q
  or    "nop"
  ( do nothing )

Those PS/PE aren't known to vile, but we could modify it to allow for that,
and then bind the keys to do nothing (in both command- and insert-mode).

> Am I being unreasonable?  Tom -- clearly you must have an understanding
> of how it should all work.  Above, you said:  "which turns it on and
> doesn't bother to turn it off when running commands."  Are you implying
> that shells turn bracketed paste on and off continuously, before and after
> every prompt?

That's what I'm guessing from your description.  It might be a particular
shell (or even some "add-on").

A shell really "should" only be using bracketed paste as a crutch in its
handling of command input/editing.  Leaving it on outside of that is not
a good idea.

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to