From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11418 invoked by alias); 2 Sep 2015 15:41:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36404 Received: (qmail 26433 invoked from network); 2 Sep 2015 15:41:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=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=9PFU4hHsSuWlauyJ wfBns+CpaO0=; b=hOIk3f4Wcyi4+QxUV/3ETRxR/9+U0BLuMUVxb1ILlwVjLOFQ TDE5SapbRyowLhqqdm5GN9GH9+KDrLx6JrkWSfEkSfNtrsFRkzizXGAZJIwur6Aa Q/vbeBXZPuKlTY2hVdTdzC2PHk70RwoD2EJIxHjK9D6TK87vwyj+IK4E1BQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=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=9PFU4hHsSuWlauy JwfBns+CpaO0=; b=Poe9mlSxLereT8Sd10zpzoaghvcuj0TMr+/hxJUZ7EZnL+Y CNkg9Izj/YSGSrfVNBh6OK0fglYwVArjCKdQv48if7KrL9iFqxvto+1e14xQXFUJ ORy2wElGyxYS1gCasRI/7/LOYS5yPpyKDGMQCm2OH5woWo17AxomSKW/OiUA= X-Sasl-enc: 7+r2q8ZBd7cvniS6NPj4QukqHHmjBEA0WjepUhNUsSyW 1441208512 Date: Wed, 2 Sep 2015 15:41:49 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: bracketed paste - chopping trailing newlines Message-ID: <20150902154149.GD9026@tarsus.local2> References: <20150829012452.GE30848@bosko.stateful.de> <150828220057.ZM14497@torch.brasslantern.com> <20150830202530.GF30848@bosko.stateful.de> <20150831054744.GB1992@tarsus.local2> <150901164448.ZM2469@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <150901164448.ZM2469@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 . 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> could be used to disable newline-stripping. Cheers, Daniel