Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads
- X-seq: zsh-workers 36878
- From: Chi Hsuan Yen <yan12125@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads
- Date: Sat, 17 Oct 2015 03:40:16 +0800
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6HL/eaeHStV1AMDGBq3mb5D65QRs6RBG4H7n24FZrUc=; b=INKoMTRUZC9VN7uSDgY5XTPG289HSRaz3n1wy/GCQ0bWEmceNjJeECU4ArjlwYNwC/ ec492ivHHRD3e9uxJ/pAS501TDaGs/NiSQ9aAg5cknELcgVQuIKE+6xOdOinLbsfzI+Z u01xJ68Lfx9cJxsp2pV0FuN3HsxZWXj9zXhqK7Jy+TzylOJEqCMECsrS4EZTMBTO3jxg daZi2mgvwHMN+7zG8JKdnq0j7H1f5gPBWWjNPb1c4a5qgRPKxOw+hWhl2R5GZFrzBbuu N9Xkfqn1AbAzZezbqScaRxukDgZQmg0LkzEA0A5TfK7aE260R+P6rNHdr7AFPXu8Pasb gVRw==
- In-reply-to: <151015172503.ZM30721@torch.brasslantern.com>
- 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: <CAMNjDR3xZP9wCuYd-3uoBBPVLa-WPa8rAgkVbPxPOC_gyZPSJg@mail.gmail.com> <CAH+w=7ZJRmbk7QzprgAqL8VWf0zPYxTcoUaZOtzv8aHp4Un6LA@mail.gmail.com> <151015172503.ZM30721@torch.brasslantern.com>
With a ubuntu 14.04 vagrant image [1] I can reproduce this bug all the time.
And the patch listed above works on neither ubuntu 14.04 nor Arch Linux.
[1]
https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
On 16 October 2015 at 08:25, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Oct 15, 1:54pm, Bart Schaefer wrote:
> } Subject: Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted
> content
> }
> } On Thu, Oct 15, 2015 at 6:54 AM, Chi Hsuan Yen <yan12125@xxxxxxxxx>
> wrote:
> } > This bug is similar to zsh-worker 36763 but different. With zsh commit
> } > 827d360, I have no problems in pasting CJK payloads with an empty
> ~/.zshrc,
> } > while problems occur with my own ~/.zshrc. It's a strange bug. Please
> tell
> } > me if you can't reproduce it. I'll test on more platforms.
> }
> } I am able to reproduce this, but not reliably.
>
> On the off chance that $(emulate) is somehow consuming some of the bytes
> being pasted, try this?
>
>
> diff --git a/Functions/Zle/bracketed-paste-magic
> b/Functions/Zle/bracketed-paste-magic
> index cd4a708..2368bc3 100644
> --- a/Functions/Zle/bracketed-paste-magic
> +++ b/Functions/Zle/bracketed-paste-magic
> @@ -116,10 +116,14 @@ quote-paste() {
> # Now the actual function
>
> bracketed-paste-magic() {
> - # Fast exit in the vi-mode cut-buffer context
> if [[ "$LASTWIDGET" = *vi-set-buffer ]]; then
> + # Fast exit in the vi-mode cut-buffer context
> zle .bracketed-paste
> return
> + else
> + # Capture the pasted text in $PASTED
> + local PASTED
> + zle .bracketed-paste PASTED
> fi
>
> # Really necessary to go to this much effort?
> @@ -127,10 +131,9 @@ bracketed-paste-magic() {
>
> emulate -L zsh
> local -a bpm_hooks bpm_inactive
> - local PASTED bpm_func bpm_active bpm_keymap=$KEYMAP
> + local bpm_func bpm_active bpm_keymap=$KEYMAP
>
> - # Set PASTED and run the paste-init functions
> - zle .bracketed-paste PASTED
> + # Run the paste-init functions
> if zstyle -a :bracketed-paste-magic paste-init bpm_hooks; then
> for bpm_func in $bpm_hooks; do
> if (( $+functions[$bpm_func] )); then
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author