zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: zsh-workers@zsh.org
Subject: Re: bracketed paste - chopping trailing newlines
Date: Mon, 7 Sep 2015 02:11:45 +0000	[thread overview]
Message-ID: <20150907021145.GC6263@tarsus.local2> (raw)
In-Reply-To: <4397.1441547465@thecus.kiddle.eu>

Oliver Kiddle wrote on Sun, Sep 06, 2015 at 15:51:05 +0200:
> Daniel Shahaf wrote:
> > The behaviour is: (a) pastes are never executed until <Enter> is pressed;
> > (b) zle_highlight is set; (c) newlines are removed only at <accept-line>.
> 
> I really don't see the point of doing (c).

Several reasons:

1. So that making several pastes in a row, which each paste a single line
including a \n, will retain the newlines.  In 5.1, the newlines will be
eaten (and users might not know how to insert literal newlines "by hand"
at a place where <accept-line> would simply execute the input-so-far).

2. Cosmetic: when I have a screenful of prompts, I'd like all of them to
have the same number of empty lines between them, regardless of whether
the command was typed manually or pasted.  In other words, once I've
decided to execute the command, I'm happy to remove any trailing \n's it
may have.

3. Avoid saving trailing newlines into history.

> Perhaps the reason for
> removing newlines in the current 5.1 behaviour has got lost in all this.
> From pre-5.1, users are accustomed to pasted newlines being executed.
> With a trailing newline, it is now hard to discern that the line hasn't
> been executed: the cursor advances to the next line whether the newline
> is accepted or inserted so without the stripping the user is left
> waiting until they lose patience.

Thanks for reminding us of that.

I do agree that we shouldn't confuse users.  However, I also think that
most useful handling of pastes is to never strip newlines.  I do not
think we should be handling pastes in a suboptimal manner in order to
avoid risking confusing users.  I think we should handle pastes
optimally — which, to me, means the behaviour described in my previous
mail — and find some other way to ensure we don't confuse users.

How about trying to collect some actual data about whether or not
newline retention confuses users?  For example, we could make the
5.1-test-2 release behave as I'm suggesting, and then wait to see
whether users who test that release complain about pasted commands
hanging indefinitely.

> I think that the default behaviour
> should cater to normal users who don't follow this list.

Agreed.

> I agree that the newline stripping isn't ideal but it seemed the best
> option for the short term. And it is possible to work around it with a
> custom widget.

I'm thinking of 'zsh -f' and of the long term.  I think the behaviour
I'm proposing would make perfect sense to someone who has never pasted
into a shell in his life.

Cheers,

Daniel


  parent reply	other threads:[~2015-09-07  2:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29  1:24 Carsten Hey
2015-08-29  5:00 ` Bart Schaefer
2015-08-30 20:25   ` Carsten Hey
2015-08-30 20:32     ` [patch] 5.0.9 vs 5.1 in source code comments (was: bracketed paste - chopping trailing newlines) Axel Beckert
2015-08-30 20:37     ` bracketed paste - chopping trailing newlines Axel Beckert
2015-08-31  5:47     ` Daniel Shahaf
2015-09-01 23:44       ` Bart Schaefer
2015-09-02 15:41         ` Daniel Shahaf
2015-09-01 23:48     ` Bart Schaefer
2015-09-03 23:59       ` Carsten Hey
2015-09-06  9:52         ` Daniel Shahaf
2015-09-06 13:51           ` Oliver Kiddle
2015-09-06 14:21             ` Bart Schaefer
2015-09-08 10:39               ` Oliver Kiddle
2015-09-10 14:45                 ` Bart Schaefer
2015-09-10 19:11                 ` Daniel Shahaf
2015-09-11 23:07                   ` Bart Schaefer
2015-09-12  0:17                     ` Mikael Magnusson
2015-09-12 15:58                       ` Bart Schaefer
2015-09-14 20:35                     ` Daniel Shahaf
2015-09-14 21:21                       ` Bart Schaefer
2015-09-07  2:11             ` Daniel Shahaf [this message]
2015-09-08 23:33             ` Carsten Hey
2015-09-08 23:48               ` Carsten Hey
2015-09-10  8:24                 ` Peter Stephenson
2015-09-07 21:13           ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150907021145.GC6263@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).