From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2351 invoked from network); 14 Apr 2008 13:55:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 14 Apr 2008 13:55:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 48468 invoked from network); 14 Apr 2008 13:55:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Apr 2008 13:55:36 -0000 Received: (qmail 9267 invoked by alias); 14 Apr 2008 13:55:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24815 Received: (qmail 9252 invoked from network); 14 Apr 2008 13:55:32 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 14 Apr 2008 13:55:32 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [85.115.41.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 10DE78043AC7 for ; Mon, 14 Apr 2008 15:55:25 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly10g.srv.mailcontrol.com (MailControl) with ESMTP id m3EDpMbM024187 for ; Mon, 14 Apr 2008 14:55:21 +0100 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Mon, 14 Apr 2008 14:54:27 +0100 Date: Mon, 14 Apr 2008 14:54:25 +0100 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: PATCH: (large) initial support for combining characters in ZLE. Message-ID: <20080414145425.566bcb92@news01> In-Reply-To: <237967ef0804140634l7e02ce6fofff7f3f3ec6c8d7c@mail.gmail.com> References: <20080413175442.0e95a241@pws-pc> <237967ef0804140634l7e02ce6fofff7f3f3ec6c8d7c@mail.gmail.com> Organization: CSR X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Apr 2008 13:54:27.0310 (UTC) FILETIME=[0DDDF8E0:01C89E37] X-Scanned-By: MailControl A-08-00-04 (www.mailcontrol.com) on 10.71.0.120 X-Virus-Scanned: ClamAV 0.91.2/6759/Mon Apr 14 14:56:05 2008 on bifrost X-Virus-Status: Clean On Mon, 14 Apr 2008 15:34:19 +0200 "Mikael Magnusson" wrote: > Hi, I'm not sure if you want bug reports at this point, but one thing > I noticed and can reproduce in zsh -f is that the cursor sometimes > gets misplaced in the terminal with combiningchars on. > % zsh -f > % setopt combiningchars > % print -z $'\u0342' > the buffer should now contain an inverted <0342>, press left or ctrl-a > or whatever to go to the start of the line and press 'a'. Here, in > both urxvt and xterm (though in xterm no ~ appears over the a) the > cursor goes to sit on the start of the previous line in the terminal. > Funnily when you backspace it goes back to the proper place in the > current buffer again. Here are a few trivial fixes for some simple problems like that---it's simply a case of moving right until we get off the combining characters. I should find a general fix for the jumping cursor problem, but for now it's quite convenient (for me, anyway) to see the problems so clearly. Index: Src/Zle/zle_hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_hist.c,v retrieving revision 1.39 diff -u -r1.39 zle_hist.c --- Src/Zle/zle_hist.c 13 Apr 2008 16:58:42 -0000 1.39 +++ Src/Zle/zle_hist.c 14 Apr 2008 13:52:18 -0000 @@ -756,10 +756,12 @@ ZS_memcpy(zleline, he->zle_text, zlell); if ((zlecs = zlell) && invicmdmode()) - zlecs--; + DECCS(); } else { setline(he->node.nam, ZSL_COPY|ZSL_TOEND); } + /* Move right if we're on a zero-width combining character */ + CCRIGHT(); setlastline(); clearlist = 1; } @@ -1548,6 +1550,7 @@ zletextfree(&zt); zle_setline(he); zlecs = cpos; + CCRIGHT(); return 0; } } @@ -1588,6 +1591,7 @@ zletextfree(&zt); zle_setline(he); zlecs = cpos; + CCRIGHT(); return 0; } } Index: Src/Zle/zle_misc.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_misc.c,v retrieving revision 1.45 diff -u -r1.45 zle_misc.c --- Src/Zle/zle_misc.c 13 Apr 2008 16:58:42 -0000 1.45 +++ Src/Zle/zle_misc.c 14 Apr 2008 13:52:33 -0000 @@ -56,6 +56,8 @@ zleline[zlecs++] = *s; if(neg) zlecs += zmult * len; + /* if we ended up on a combining character, skip over it */ + CCRIGHT(); } /**/ Index: Src/Zle/zle_tricky.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v retrieving revision 1.92 diff -u -r1.92 zle_tricky.c --- Src/Zle/zle_tricky.c 14 Apr 2008 09:13:18 -0000 1.92 +++ Src/Zle/zle_tricky.c 14 Apr 2008 13:52:45 -0000 @@ -980,14 +980,11 @@ free(zlemetaline); zlemetaline = NULL; - -#ifdef MULTIBYTE_SUPPORT /* * If we inserted combining characters under the cursor we * won't have tested the effect yet. So fix it up now. */ - alignmultiwordright(1); -#endif + CCRIGHT(); } /* Free a brinfo list. */ -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070