Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) 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.1
Date: Fri, 6 May 2016 22:53:10 +0200
From: Axel Beckert <abe@deuxchevaux.org>
To: zsh-workers@zsh.org
Subject: bracket-paste-magic adds backslashes inside a quoted string if URL
 is pasted ("regression" compared to pre-5.1 url-quote-magic)
Message-ID: <20160506205309.GY5029@sym.noone.org>
Mail-Followup-To: zsh-workers@zsh.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Operating-System: Linux 3.2.0-4-amd64
X-Machine: sym2 x86_64
X-Editor: GNU Emacs 23.4.1
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAAAAAC3mUtaAAAABGdBTUEAALGPC/xhBQAAADh0RVh0U29mdHdhcmUAWFYgVmVyc2lvbiAzLjEwYSAgUmV2OiAxMi8yOS85NCAoUE5HIHBhdGNoIDEuMindFS5JAAACGElEQVQ4jXXQMU8UYRDG8f8shNjdDH4AbpfGDjAWlKiJiZ0ajL1aGCvsNCbGaCGG1koLaztaTYz6ATy+gOyehYmF3MxVxgg3FnDsHcTpJr/M+8w7Rf6nCsaVTTDqxbg9hoOXmw83H71+Eyfg4E1d7/Z2fG9rGkZbTQiu+K+3U/C+76lmkvAhJuDndnoAiftou4V84okAGclop4U/jYACZDTxrYWP0gkxVfAm/W//GLZpxIzwIN0Hn8dw0B+IWkZmQmRsj2HfhwokEklHfNCCiQCRgAR7YyhQVRVTCKCzP4Y5zBBE0t0zY3Q8oQaBqqAMlVEcgVQd9706zGirAFium8HXumlMIeMwqQCInju+2+uB6MRENupdpMt8pRlHZyuAW0F+Mb6XSIVqtxjD+iVmVqqystLEzFTGT92YqRaXpNT5eTVjeJhbALPnrTxLUZUKZsgxcNm64hAOYisT/xhF+oKTGU5RegtC3Rt6eEDi/QnIevdTx9Md2EMmYBRmCQR1026FCGQQJJExsRUqgkMGaWSbwYLnoO4T6VgpbQbdELPMBAHWWrhYrcxXnYgAsatPWygkFCBD4K62MAsOTqA6szYRPpsu6e6Y8mPiVrBMNuGIMrgwBUu4p2DgG1Ownu6hpuTv7hScefHAzAC/yRRw5U5pALMbJ4AUALvHSZhxgHPXTsHcdWD1GadAHr9avP+c0wCr7263Df8ASLwXWHWs+KIAAAAHdElNRQfYBQEBODPr
Organization: DeuxChevaux.org -- The =?iso-8859-1?Q?Citr?=
 =?iso-8859-1?B?b+tu?= 2CV Database
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Seq: zsh-workers 38413

Hi,

I have the following snippet in my .zshrc:

  autoload -U url-quote-magic
  zle -N self-insert url-quote-magic
  autoload -Uz bracketed-paste-magic
  zle -N bracketed-paste bracketed-paste-magic

The latter two lines are only necessary for zsh ≥ 5.1, but don't seem
to do any harm for earlier versions.

Wth this configuration I noticed the following regression which has
probably been added with zsh 5.1: I can't reproduce it with 5.0.7 in
Debian Stable, but can reproduce it with 5.2 in Debian Unstable as
well as with the current git HEAD:

Pasting an URL, e.g.

  https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=zsh

into zsh with url-quote-magic activated resulted in the the following
commandlines with 5.0.7 (pasting starts with the URL, all other
characters were typed):

  % echo https://bugs.debian.org/cgi-bin/pkgreport.cgi\?src\=zsh

  % echo "https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=zsh

  % echo 'https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=zsh

This is exactly what I expect: backslashes for quoting were only added
if no quoting using single or double quotes has been started already.

But with zsh 5.2 (and zsh git HEAD), it looks like this:

  % echo https://bugs.debian.org/cgi-bin/pkgreport.cgi\?src\=zsh

  % echo "https://bugs.debian.org/cgi-bin/pkgreport.cgi\?src\=zsh

  % echo 'https://bugs.debian.org/cgi-bin/pkgreport.cgi\?src\=zsh

While the first example still works as expected, I consider the latter
two examples to be some kind of regression. No backslashes should be
added in these cases.

But it only happens if I paste the full URL. It doesn't happen if I
just type the URL and it doesn't happen if just paste the "?src=zsh".
So I can imagine that this possibly is just a missing feature of
bracketed-paste-magic and not a real regression in url-quote-magic.

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail)
 X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)

