From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20944 invoked by alias); 10 Sep 2015 19:35:33 -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: 36483 Received: (qmail 29086 invoked from network); 10 Sep 2015 19:35:32 -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-Originating-IP: [80.3.228.158] X-Spam: 0 X-Authority: v=2.1 cv=AJvf2gUA c=1 sm=1 tr=0 a=P+FLVI8RzFchTbbqTxIDRw==:117 a=P+FLVI8RzFchTbbqTxIDRw==:17 a=NLZqzBF-AAAA:8 a=kj9zAlcOel0A:10 a=dSVKHJ_C8KoLyBM_J68A:9 a=CjuIK1q_8ugA:10 Date: Thu, 10 Sep 2015 20:35:27 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Pasting UTF-8 characters with bracketed-paste-magic seems broken in 5.1 Message-ID: <20150910203527.260abe86@ntlworld.com> In-Reply-To: <20150910195713.340861cb@ntlworld.com> 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> <20150910195713.340861cb@ntlworld.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 10 Sep 2015 19:57:13 +0100 Peter Stephenson wrote: > Now should be possible to do more in shell code... This seems to be getting somewhere, but possibly needs more expert examination... I suppose I'd better leave making a build till tomorrow. pws diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index 49f4b66..464c6b3 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -164,17 +164,25 @@ bracketed-paste-magic() { integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO UNDO_LIMIT_NO=$UNDO_CHANGE_NO + local mbchar + integer ismb while [[ -n $PASTED ]] && zle .read-command; do - PASTED=${PASTED#$KEYS} - if [[ $KEYS = ${(~j:|:)${(b)bpm_inactive}} ]]; then - zle .self-insert-unmeta + mbchar=$KEYS + ismb=0 + while [[ $mbchar = [[:INCOMPLETE:]]* ]] && zle .read-command; do + mbchar+=$KEYS + ismb=1 + done + PASTED=${PASTED#$mbchar} + if [[ ismb -ne 0 || $mbchar = ${(~j:|:)${(b)bpm_inactive}} ]]; then + LBUFFER+=$mbchar else case $REPLY in (${~bpm_active}) function () { emulate -L $bpm_emulate; set -$bpm_opts zle $REPLY };; - (*) zle .self-insert-unmeta;; + (*) LBUFFER+=$mbchar; esac fi done