bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bracketed-paste-mode should default to "off"


From: Chet Ramey
Subject: Re: bracketed-paste-mode should default to "off"
Date: Thu, 3 Feb 2022 15:28:33 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1

On 2/1/22 6:59 PM, Karl O. Pinc wrote:
Per Bothner wrote:
On 1/31/22 20:47, Karl O. Pinc wrote:

  My argument is that Unix should come with the training
  wheels off, by default.

That's not an argument, it's a preference.

True.  A design preference.  The argument is that
this has been the design preference for Unix since
day 1.  A counter argument is that there've been
"newbie friendly" distros turning the knobs and adding
guard rails for a long time now.

I'm as old-time Unix as anyone, and I believe the most desirable goal
should be maximum usability for the largest set of users.

I'd argue that the "core" should continue to follow
the original design principals and default to a uniform
design.

Hmmm...what's more `uniform' about defaulting bracketed-paste to off?
There's a good argument to be made that it's more consistent to have it
on (see below).


The design choices can then be tweaked in
whatever direction system integrators think benefit
the user's they serve.

It's easy to change the default at configure time. Like just about anything
else, you're going to be subject to the distro's preferences. If they want
to change the default, they will; if they think the default is more usable,
you'll get that.


  "Simple" and "obvious" seems more useful than "safe".

"Simple" and "obvious" are often synonyms for "familiar."


I also think bracketed-paste-mode=on is just plain more useful.

Agreed. There is additional utility.  Although I only see the
more advanced user utilizing the utility.  (More below.)

That's not exactly true. It reduces surprises and questions about why the
pasted text didn't end up in the readline line buffer.

  It took a couple of months of being annoyed at my pastes not "working"

In what sense?

The main point of bracketed paste mode, as explained to me in
the few communications I've had about it, is to allow editing
of pasted text before acceptance.

Not really. That's a side effect of the primary benefit, which is to
accurately reproduce the pasted text. Without bracketed paste, there's
no way to distinguish between pasted text and text entered directly at
the keyboard. Not a problem, you might say, until you realize that the
pasted characters are all interpreted as being bound to some readline
command, and the ones that aren't bound to self-insert can have potentially
unintended effects on the line buffer. The most common such character is
TAB.

It would, of course, be possible to check whether the last character of
the bracketed paste was a newline and perform an implicit accept-line,
but I've never been inclined to add that special case.


With bracketed paste on, when pasting anything containing a newline,
it is as if there's a "Press enter to continue" invisible dialog that
pops up.  There is no way to tell that your terminal is waiting
for you to do something.  Typing "sleep 10\n" and pasting "sleep 10\n"
look exactly the same but behave completely differently.

They don't appear identical, at least in readline-8.1.

The
former sleeps 10 seconds.  The latter sleeps forever, or at
least until a newline is actually typed.

That's one of the reasons the active region is highlighted, so you know
what was pasted and that readline is still waiting for input.


IMO this would be completely confusing to a beginner.  How are
they supposed to know that performing a paste operation requires
multiple steps before the computer will accept their paste?
It is simple and obvious when a newline always causes a
command to execute.  It is complicated and confusing when
a newline causes differing behaviors depending on how it got there.
Especially when there's no visual indication of the
difference between one sort of newline and another.

There is a visual difference. Pasted text is rendered in reverse video.
That's what the active region does. (And, believe me, that generated
more complaints than bracketed paste.)

The active region feature came in at the same time I made bracketed paste
the default.



On re-reading the readline man page I see that the
declared point of bracketed paste mode is to "prevent
pasted characters from being interpreted as editing
commands".  That seems a worthy goal, and not invasive.
But the actual implementation has altered newline
behavior, which I see as a big change that makes
the system significantly more complicated.

It's exactly the same thing. Newline is bound to a readline command like
all other characters (accept-line). What you want is an exception to the
general rule.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]