From: Yuri D'Elia <wavexx@thregr.org>
To: zsh-workers@zsh.org
Subject: Re: bracketed paste
Date: Thu, 16 Jul 2015 16:32:18 +0200 [thread overview]
Message-ID: <mo8f9k$qt2$1@ger.gmane.org> (raw)
In-Reply-To: <7277.1437023995@thecus.kiddle.eu>
On 16/07/15 07:19, Oliver Kiddle wrote:
> Yuri D'Elia wrote:
>>
>> Also, I realized sometimes a final newline was tricking me into thinking
>> that the command was already enter-ed to the shell (but of course, it
>> wasn't). Stripping any final newlines is an improvement.
>
> Should we perhaps do this in the default widget? That is strip off the
> last character if it is a newline. With a default setup, it isn't
> actually possible to see the difference between the newline being
> inserted and the command being executed but doing nothing for a long
> time. In either case, the cursor position is the same.
I don't think that removing it only if it's the final character is
enough. A string like "\n " is also tricky to spot somehow.
I would say a better improvement would be to remove any trailing empty
lines. Something like /(\n\s*$)+/.
But then again, if you're pasting spaces, the cursor might also end-up
being exactly at the beginning of the new line.
It kind of depends on what are your expectations on paste. If you're
pasting spaces on purpose (for example, to concatenate more commands),
you kinda expect paste to be literal. I do this from time to time: paste
beginning from here, rest from there, or paste whitespaces in a literal
quote (yes!). Terminal-to-terminal pastes are often containing
intentional blanks and newlines. What brakes it is mostly paste from a
rich web page, where the selection is often aleatory.
I'm quite happy with the whitespace trimming on both ends. The fact that
I could do the same with the new widget is also good.
Although I'm not sure I would need to unquote the string before
stripping when a prefix argument is given: in that case my stripping
function would break, and I need to know if the argument was given or
not to perform the unquote/quote.
In that scenario, maybe a "paste_trimmed" style would be better. It
avoids the kludges, and it's obvious: either you want literal paste, or
you don't want excess whitespace around.
next prev parent reply other threads:[~2015-07-16 14:32 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 16:51 Yuri D'Elia
2015-07-15 17:33 ` Yuri D'Elia
2015-07-15 18:15 ` Mikael Magnusson
2015-07-15 18:43 ` Yuri D'Elia
2015-07-16 5:19 ` Oliver Kiddle
2015-07-16 14:32 ` Yuri D'Elia [this message]
2015-07-18 2:33 ` Oliver Kiddle
2015-07-18 11:55 ` Yuri D'Elia
2015-07-18 17:17 ` Bart Schaefer
2015-07-18 23:28 ` Oliver Kiddle
2015-07-19 8:13 ` Unmetafy of getsparam() Bart Schaefer
2015-07-21 20:07 ` Peter Stephenson
2015-07-21 23:08 ` Bart Schaefer
2015-07-23 8:50 ` Peter Stephenson
2015-07-16 20:15 ` bracketed paste Bart Schaefer
2015-07-18 12:05 ` Yuri D'Elia
2015-07-18 18:08 ` Bart Schaefer
2015-07-19 2:50 ` PATCH: highlight pasted text Oliver Kiddle
2015-07-19 8:17 ` Bart Schaefer
2015-07-19 12:13 ` Yuri D'Elia
2015-07-19 17:12 ` Daniel Shahaf
2015-07-19 18:10 ` Bart Schaefer
2015-07-21 15:23 ` Oliver Kiddle
2015-07-21 17:35 ` Bart Schaefer
2015-07-23 3:57 ` Oliver Kiddle
2015-07-19 17:57 ` Oliver Kiddle
2015-07-19 18:09 ` Yuri D'Elia
2015-08-08 21:51 ` Daniel Shahaf
2015-08-14 1:38 ` Oliver Kiddle
2015-08-14 5:28 ` Bart Schaefer
2015-07-23 5:00 ` Mikael Magnusson
2015-07-23 6:23 ` Oliver Kiddle
2015-07-24 5:06 ` Bart Schaefer
2015-07-24 5:21 ` Bart Schaefer
2015-07-24 22:22 ` Oliver Kiddle
2015-07-24 23:13 ` Bart Schaefer
2015-07-25 7:49 ` Oliver Kiddle
2015-07-25 16:46 ` zle options (was Re: PATCH: highlight pasted text) Bart Schaefer
2015-07-28 9:09 ` Oliver Kiddle
2015-07-24 19:06 ` Vim special marks - Re: PATCH: highlight pasted text Oliver Kiddle
2015-07-24 19:45 ` Bart Schaefer
2015-08-11 11:16 ` Oliver Kiddle
2015-08-13 23:14 ` Daniel Shahaf
2015-08-13 23:50 ` Bart Schaefer
2015-08-14 2:09 ` Oliver Kiddle
2015-08-14 5:24 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
2015-11-18 19:57 bracketed paste Yuri D'Elia
2015-11-19 6:05 ` Bart Schaefer
2015-11-19 9:33 ` Yuri D'Elia
2011-11-07 22:31 Oliver Kiddle
2011-11-07 22:42 ` Mikael Magnusson
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='mo8f9k$qt2$1@ger.gmane.org' \
--to=wavexx@thregr.org \
--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).