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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_PCNT
	autolearn=no autolearn_force=no version=3.4.1
Date: Tue, 10 May 2016 10:58:33 +0200
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: bracket-paste-magic adds backslashes inside a quoted string if
 URL is pasted ("regression" compared to pre-5.1 url-quote-magic)
Message-ID: <20160510085833.GA20332@cventin.lip.ens-lyon.fr>
Mail-Followup-To: zsh-workers@zsh.org
References: <20160506205309.GY5029@sym.noone.org>
 <160508115026.ZM10022@torch.brasslantern.com>
 <20160509141306.GA18211@cventin.lip.ens-lyon.fr>
 <160509084143.ZM13554@torch.brasslantern.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <160509084143.ZM13554@torch.brasslantern.com>
X-Mailer-Info: https://www.vinc17.net/mutt/
User-Agent: Mutt/1.6.0-6619-vl-r87826 (2016-04-11)
X-Seq: zsh-workers 38459

On 2016-05-09 08:41:43 -0700, Bart Schaefer wrote:
> On May 9,  4:13pm, Vincent Lefevre wrote:
> } Subject: Re: bracket-paste-magic adds backslashes inside a quoted string i
> }
> } On 2016-05-08 11:50:26 -0700, Bart Schaefer wrote:
> } > You want
> } > 
> } >     zstyle :bracketed-paste-magic paste-init backward-extend-paste
> } > 
> } > so that the quote marks that are already on the line are treated as
> } > part of the pasted text.
> } 
> } Shouldn't this be the default behavior?
> 
> We had quite a bit of discussion on related topics when bracketed-paste
> was added.  The general idea is that a paste is treated as a unit, and
> the default behavior of bracketed-paste-magic is to restrict its action
> to remain "inside" that unit.

I'm not sure what you call "unit", but IMHO, the notion of unit
should be different from the notion of argument. For instance,
I would agree that a URL could be regarded as a unit, and after

  echo "The URL is: 

it makes sense to paste a URL. So, the context should matter.

> backward-extend-paste is appropriate when bracketed-paste-magic combines
> with url-quote-magic, but not necessarily so in other cases.  paste-init
> (and paste-finish) can be used for this kind of thing generically; the
> backward-extend action is included by default, but has to be turned on.

Or perhaps there should be a function that does all the work for
URL handling, e.g. currently

  autoload -Uz url-quote-magic
  zle -N self-insert url-quote-magic
  autoload -Uz bracketed-paste-magic
  zle -N bracketed-paste bracketed-paste-magic
  zstyle :bracketed-paste-magic paste-init backward-extend-paste

in case there would be future changes.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

