Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bracketed paste
- X-seq: zsh-workers 35814
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: bracketed paste
- Date: Sat, 18 Jul 2015 04:33:02 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1437186783; bh=8/Sr3woAxp6MWmyW0dh/9SUZ/b8cDNNxXDBoIERB8Iw=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=lFYjozSBygyZkmG2qi/G5LBp3ev/aMYLs10enAllC892wiI4vkUY5F/AJ7lDGjqObvkGhajch+eXLbQpa8rtLmh0rBrNs8KpJM+ScQv2zjHsdU3woUCClv02dTYd32uvL1+ESs9psmus/B3t/a+K62Xe97EeDkCWECuQ+LcCcLQNhTImHjMJhEhCF2O7SPYvFebxeDT9rpvpk3sZw+G4BncXkrhzrFAQuRD6e17XDh9+dwmOHRSZBSYQPfojYVICZ5CGnQO6qprP1ssSbuvz7Ytj4LWgI53y7MaSWG59bPoei2wxJmcBPQtZ80Jrkta4JYvhQyAjnEO30MMp4mt/kg==
- In-reply-to: <mo8f9k$qt2$1@ger.gmane.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <mo6325$r5k$1@ger.gmane.org> <7277.1437023995@thecus.kiddle.eu> <mo8f9k$qt2$1@ger.gmane.org>
Yuri D'Elia wrote:
> I would say a better improvement would be to remove any trailing empty
> lines. Something like /(\n\s*$)+/.
> 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.
My concern is the average user that doesn't configure this. At the
moment people are used to pasted newlines being accepted. If with 5.0.9,
they paste a single line command including a trailing newline, there is
no visible clue to tell them that things have changed: the cursor sits
at the beginning of the next line and the user wonders for a few seconds
why their command is taking so long.
Like Bart, I'd rather the text is not altered. Sometimes I really want
it verbatim and I can't write a widget to unalter it. Stripping just a
single final newline wouldn't bother me greatly, however and it would
mostly solve to concern I described above. There may be other solutions.
For example I quite like the effect you get by putting normal characters
in POSTEDIT followed by a carriage return, some examples:
POSTEDIT+=$' Please wait...\r'
POSTEDIT+=$'\u2588\u231b\r'
POSTEDIT+=$'\u2584\b'
(note that there seems to be a bug that we aren't doing unmeta() on
postedit so you might need the patch below for these).
Anyway, I'm not sure that a style achieves much because it isn't hard
to write a custom widget and a widget is more flexible. The trick of
using a prefix key also means you can have a selection: raw, quoted,
whitespace removed, ${(Z.C.)var} for comment removal etc.
Oliver
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index c13e3a0..e610ae1 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1865,7 +1865,7 @@ trashzle(void)
clearflag = listshown = 0;
}
if (postedit)
- fprintf(shout, "%s", postedit);
+ fprintf(shout, "%s", unmeta(postedit));
fflush(shout);
resetneeded = 1;
if (!(zlereadflags & ZLRF_NOSETTY))
Messages sorted by:
Reverse Date,
Date,
Thread,
Author