From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16391 invoked by alias); 29 Aug 2015 05:01:06 -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: 36324 Received: (qmail 20343 invoked from network); 29 Aug 2015 05:01:04 -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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:cc:mime-version:content-type; bh=jpYmM2LUhFpaEywXl5/Z4O7u5bHVCiAHlKIZavRVLi0=; b=OFVQrA3Tg6HXOiw84Wm4SJRNLb0zMPc5oAV9N0gBlxrfymKeMb48/YBczTVrnSvspZ UIIrZsNo4VcVTWLocoH0a1CJbBM6ae3bJjouyhHH08CkojbMf9yCyFgitN3WgIf/pldM MmRprKKBQ5LkJDvruxLvwUcRFP/dsi+HnZFxRVPRon3TK+WalHC+MHLBnKPC6uqdUxtd bkR7WZaTrWmsDQMBvlqb8WQidprVlbSJpAdE5M+/ocTdHABwJl0ZsdVd8j6GDZZPGk9w nnjQNXzkICfrG423Oi6tujP1oGpXwpcwshzvTbiaWizNVmCcREZHB018DyozeOru5z2m PfNg== X-Gm-Message-State: ALoCoQlGVdwv1+iCbq8yvZ2c4CqzLVdVbk76WF71jQAuFe485Tj/Q7m70pDzcqREGiAbKc2nNotY X-Received: by 10.202.54.131 with SMTP id d125mr2882303oia.62.1440824459628; Fri, 28 Aug 2015 22:00:59 -0700 (PDT) From: Bart Schaefer Message-Id: <150828220057.ZM14497@torch.brasslantern.com> Date: Fri, 28 Aug 2015 22:00:57 -0700 In-Reply-To: <20150829012452.GE30848@bosko.stateful.de> Comments: In reply to Carsten Hey "bracketed paste - chopping trailing newlines" (Aug 29, 3:24am) References: <20150829012452.GE30848@bosko.stateful.de> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: bracketed paste - chopping trailing newlines Cc: Carsten Hey MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Reordering things a bit for response ... On Aug 29, 3:24am, Carsten Hey wrote: } } The other natural choice to enable distinguishing a running command from } a paste is using zle_highlight. This could also avoid the need for the } possibly unexpected newline stripping feature. } } An alternative to paste:standout is paste:underline. Given that this } one does not suffer from similar possible problems as paste:standout, Hm, standout, boldface, and underline are all used already for different defaults. Underline is for isearch, though, so I suppose it's quite unlikely to clash with paste highlighting. } [...] I think, that a trailing newline should only } be stripped if it does not immediately follow an other newline Another way to approach this would be for a trailing newline to actually be taken as accept-line, provided that RBUFFER is empty. This would be the least different from previous (unbracketed) paste behavior, and could be independent of the number of trailing newlines. In contexts other than PS1, e.g., a here-document, this is identical to keeping the trailing newline (except that the PS2 prompt is repeated). Here's a way to try that on for size: autoload -Uz bracketed-paste-magic zle -N bracketed-paste bracketed-paste-magic nl-accept () { if [[ "$PASTED" = *$'\n' && -z "$RBUFFER" ]] then PASTED="${PASTED%?}" zle -U $'\n' fi return 0 } zstyle :bracketed-paste-magic active-widgets '' zstyle :bracketed-paste-magic paste-finish nl-accept