From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12806 invoked by alias); 16 Oct 2015 19:40:21 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36878 Received: (qmail 22147 invoked from network); 16 Oct 2015 19:40:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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== MIME-Version: 1.0 X-Received: by 10.13.228.65 with SMTP id n62mr11566703ywe.302.1445024416943; Fri, 16 Oct 2015 12:40:16 -0700 (PDT) In-Reply-To: <151015172503.ZM30721@torch.brasslantern.com> References: <151015172503.ZM30721@torch.brasslantern.com> Date: Sat, 17 Oct 2015 03:40:16 +0800 Message-ID: Subject: Re: Bug: bracketed-paste-magic + ztcp causes wrong pasted contents for CJK payloads From: Chi Hsuan Yen To: Bart Schaefer Cc: Zsh hackers list Content-Type: multipart/alternative; boundary=94eb2c030c10105cc105223df728 --94eb2c030c10105cc105223df728 Content-Type: text/plain; charset=UTF-8 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 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 > 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 > --94eb2c030c10105cc105223df728--