zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
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)
Date: Tue, 10 May 2016 12:58:48 -0700	[thread overview]
Message-ID: <160510125848.ZM1686@torch.brasslantern.com> (raw)
In-Reply-To: <20160510085833.GA20332@cventin.lip.ens-lyon.fr>

On May 10, 10:58am, Vincent Lefevre wrote:
}
} > 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"

A single keystroke.  A single widget event.  As if the entire paste, no
matter how large, is one indivisible object.

} but IMHO, the notion of unit
} should be different from the notion of argument.

"Argument" has no bearing here; these are units of user input, like,
say, pressing a function key; not units of shell syntax or command
line semantics.

Of course the reason bracketed-paste-magic exists is because sometimes
one might not want that.  The opposite end of the spectrum would be to
explode the paste completely into its individual keystrokes, but that's
no different than unsetting zle_bracketed_paste to turn it off.  So
with bracketed-paste-magic I took the route of keeping the pasted text
self-contained, like doing a recursive-edit or using the minibuffer,
but providing hooks to bring in surrounding context if desired.

bracketed-paste-url-magic takes a different approach, examining the
paste to see if it starts with a URI scheme and if so quoting the
whole thing, and otherwise not interfering with the default paste
behavior at all (so you get even less context sensitivity).

A third (so far unimplemented) approach would be to examine LBUFFER
for an unbalanced quote mark and treat the paste accordingly, but
what exactly does "accordingly" mean?  Escape any quotes of the same
type that are in the paste, or assume the user is intentionally
pasting the closing quote?

} Or perhaps there should be a function that does all the work for
} URL handling

There's more than one way to do it even now, so someone would have to
make a judgement call as to which way was "the" way in order to create
such a function.


  reply	other threads:[~2016-05-10 19:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 20:53 Axel Beckert
2016-05-08 18:50 ` Bart Schaefer
2016-05-09 14:13   ` Vincent Lefevre
2016-05-09 15:41     ` Bart Schaefer
2016-05-10  8:58       ` Vincent Lefevre
2016-05-10 19:58         ` Bart Schaefer [this message]
2016-05-13  9:23           ` Vincent Lefevre
2016-05-13 11:06             ` Bart Schaefer
2016-05-13 12:19               ` Vincent Lefevre
2016-06-02  7:20                 ` undo problems/crashes (was Re: bracket-paste-magic ...) Bart Schaefer
2016-05-13 22:20               ` bracket-paste-magic adds backslashes inside a quoted string if URL is pasted ("regression" compared to pre-5.1 url-quote-magic) Daniel Shahaf
2016-05-14  1:33                 ` Mikael Magnusson
2016-05-14  3:00                   ` Daniel Shahaf
2016-05-15 11:59                     ` Bart Schaefer
2016-05-19 21:14                       ` Daniel Shahaf
2016-06-02  7:06                         ` zle hook conventions (was Re: bracket-paste-magic ...) Bart Schaefer
2016-06-03 20:40                           ` Daniel Shahaf
2016-06-03 22:51                             ` Bart Schaefer
2016-06-04 16:57                               ` Daniel Shahaf
2016-06-10 17:36                           ` Daniel Shahaf
2016-06-10 19:51                             ` Bart Schaefer

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=160510125848.ZM1686@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).