From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: bracketed paste - chopping trailing newlines
Date: Wed, 2 Sep 2015 15:41:49 +0000 [thread overview]
Message-ID: <20150902154149.GD9026@tarsus.local2> (raw)
In-Reply-To: <150901164448.ZM2469@torch.brasslantern.com>
Bart Schaefer wrote on Tue, Sep 01, 2015 at 16:44:48 -0700:
> On Aug 31, 5:47am, Daniel Shahaf wrote:
> } The problem of user not realizing the command hasn't started to run
> } could be solved by having zle_highlight=(paste:...) and/or a 'zle -M'
> } message by default.
>
> On further reflection I don't think highlighting the paste is sufficient
> to solve this. Yes, it lets you know that a paste has occurred, but it
> doesn't help with realizing that a paste doesn't result in accept-line
> if you aren't already familiar with that.
>
The purpose of the standout isn't to tell people that a paste occurred,
but to alert them to the changed behaviour of the shell. The standout
should serve as a clue that the shell is waiting for input. It may also
serve as a "concomitant unexplained phenomenon" — "My command isn't
executing, and the text I pasted is in reverse video" — which might
assist the user in debugging the unforeseen behaviour.
> } As I've stated in other threads, my preferred option is to simply never
> } munge the user data at all, to minimize surprising behaviour and
> } maximize compatibility with other places that accept pastes.
>
> Of course the problem is that "least surprise" for a current user of zsh
> is for the newlines to be accept-line, whereas for a person expecting
> the behavior of a text editor the newlines should just be inserted.
>
An argument that the "least surprise" for a current user of zsh is the
status quo can be used to argue against any change whatsoever.
> My suggestion of accept-line for a final newline only when RBUFFER is
> empty was meant as the least objectionable hybrid of the two.
>
> } Is there any other place accepting pastes that removes the final
> } newline? Everywhere I can think of just pastes the final newline if it
> } was part of the copied text.
>
> This is also considered by my hybrid suggestion -- the newline is not
> removed; it is part of the paste. It just means something different at
> the end of the line (it means what a newline usually means at the end
> of a line).
I actually quite like the New World Order, in which nothing gets
executed until I press <Enter>. The only time it irks me is when I run
zsh -f
source ./minimal-repro-recipe.zsh
repeatedly, which I do when debugging the shell... but that doesn't
count as a use-case :)
---
In the meantime, I've reverted the strip-final-newline patch (35834)
locally, and I'll keep an eye on my use patterns to see how well
Carsten's suggestion would work for me. As to Bart's idea, I expect
I will sometimes try to paste a multiline string and _not_ want it to be
executed (e.g., because I'll want to edit it first); perhaps <^V><paste>
could be used to disable newline-stripping.
Cheers,
Daniel
next prev parent reply other threads:[~2015-09-02 15:41 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 [this message]
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
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=20150902154149.GD9026@tarsus.local2 \
--to=d.s@daniel.shahaf.name \
--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).