From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19030 invoked by alias); 10 Sep 2015 19:21:02 -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: 36479 Received: (qmail 21116 invoked from network); 10 Sep 2015 19:21:00 -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 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=Q5WhUNmyuYUEk9se8v+fCCNro5VwI7Hym6ESfPD/ca4=; b=iHs1O/AjZWjs/MVqMYV3QTfeQP8g300E3Kr1c7vYC+C9eHrWTifpf+tvRTx09PWHMm KsuYtldaRXZHC5Uu+7JGsSCUvIcH90zqXOYEiNC/t9aZHdrDYs6zbmLjv6CRgAPt93mw 2dqNhbKBMdIE/dmjaLDsp5vp92MG1MkckmHaxpnEB0LVFF7p4vWIPqUCi5Vjk+N5ctG+ lG58SE9nnTLrya1EB8EcXXSwGLUxsRO97Ap/z82hT9aJG41ZDiN47ZFf2dgqhPBCky+H FulfzVa4UEoLM20O0Qy6/hpElZv+NWz1wpeQAHX8pCAFzarjjmpbVMoy/NBNyU0xbFYo vgUg== X-Gm-Message-State: ALoCoQnWEbhYlUbnKSilmmAOY7FioeiccrgFfQX4SD4TUmiwskwpZcLS+yEN8stjsFXVTifDfOnq X-Received: by 10.202.169.65 with SMTP id s62mr33055424oie.28.1441912858855; Thu, 10 Sep 2015 12:20:58 -0700 (PDT) From: Bart Schaefer Message-Id: <150910122055.ZM3818@torch.brasslantern.com> Date: Thu, 10 Sep 2015 12:20:55 -0700 In-Reply-To: <20150910172840.0a1899f4@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: Pasting UTF-8 characters with bracketed-paste-magic seems broken in 5.1" (Sep 10, 5:28pm) References: <20150906155751.GD3721@sym.noone.org> <150910073920.ZM21998@torch.brasslantern.com> <20150910145714.GO3721@sym.noone.org> <150910084516.ZM22892@torch.brasslantern.com> <20150910170705.0fbeb302@pwslap01u.europe.root.pri> <150910091649.ZM3715@torch.brasslantern.com> <20150910172840.0a1899f4@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Pasting UTF-8 characters with bracketed-paste-magic seems broken in 5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 10, 5:28pm, Peter Stephenson wrote: } Subject: Re: Pasting UTF-8 characters with bracketed-paste-magic seems bro } } On Thu, 10 Sep 2015 09:16:49 -0700 } Bart Schaefer wrote: } } > Should be possible to handle that in the loop in bracketed-paste-magic } > with a test of $KEYS and a call to read -k. Might try to get to this } > later, out of time now ... or someone else can jump in. } } Not really clear to me what level the "right" fix is, since this was all } designed for a pre-multibyte world... I don't think we have a test for a } valid/invalid multibyte character at the shell level currently, do we? We can probably get by with some variant of this: read-multibyte() { local K=$KEYS[-1] if (( ##K & 0x80 )); then if (( ##K & 0xe0 == 0xc0 )); then read -k 1 K elif (( ##K & 0xf0 == 0xe0 )); then read -k 2 K elif (( ##K & 0xf8 == 0xf0 )); then read -k 3 K fi KEYS+="$K" fi } while zle .read-command; do read-multibyte # etc. done Except "read -k" is supposed to read a full multibyte character, so I don't know if it behaves consistently when invoked in the middle of one. -- Barton E. Schaefer