Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bracketed paste - chopping trailing newlines
- X-seq: zsh-workers 36438
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: bracketed paste - chopping trailing newlines
- Date: Mon, 7 Sep 2015 02:11:45 +0000
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=tXS2v4Ks4aBhjG+/ FeCqem7qDTE=; b=ZYMwwJ4iKdNqYKTyOeTusw9iLfN2vPjMUQI1BSwKAt7BBRqB pLNCGQQzmifVKGvDSpApUllD9GqMfZy7gd1RJeJNgE5fpw2j10xNEt77mSE+rEjt +m7e+lw5kfZypn4rz6iS+voFbh9wfd5YT4euuFGJ+rT9Fmmmnhj0MTu8n9Q=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=tXS2v4Ks4aBhjG+ /FeCqem7qDTE=; b=ohP6g5ZYWcXfsG4wu6XHqJWt9owVLZPm5c6OyZ1ODV+b30l thMmi/B6L/2BEmYvZRPurYLsh6lI6QpzwhexSAqvbIX7cYh7vXLAyG0kKHkl+LOR mKvwj3u1tI5sqfv1l8xL/KzdbqvafxAIakBGNBEez9v1C6gjpT1n6GQBVtVQ=
- In-reply-to: <4397.1441547465@thecus.kiddle.eu>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20150829012452.GE30848@bosko.stateful.de> <150828220057.ZM14497@torch.brasslantern.com> <20150830202530.GF30848@bosko.stateful.de> <150901164827.ZM2480@torch.brasslantern.com> <20150903235936.GH30848@bosko.stateful.de> <20150906095224.GD1895@tarsus.local2> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author