From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26392 invoked from network); 20 Apr 2008 16:50:57 -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.5 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; 20 Apr 2008 16:50:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 32563 invoked from network); 20 Apr 2008 16:50:53 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Apr 2008 16:50:53 -0000 Received: (qmail 24006 invoked by alias); 20 Apr 2008 16:50:51 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24852 Received: (qmail 23985 invoked from network); 20 Apr 2008 16:50:51 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 20 Apr 2008 16:50:51 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id B2810808A37A for ; Sun, 20 Apr 2008 18:50:47 +0200 (CEST) Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20080420165406.TQKS17818.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Sun, 20 Apr 2008 17:54:06 +0100 Received: from pws-pc ([81.107.40.67]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20080420165304.CLVW17393.aamtaout02-winn.ispmail.ntl.com@pws-pc> for ; Sun, 20 Apr 2008 17:53:04 +0100 Date: Sun, 20 Apr 2008 17:50:14 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: combining char in vi-keybinding Message-ID: <20080420175014.5d30a9bd@pws-pc> In-Reply-To: <9038EB93-1E0B-4870-986A-CECD34805580@kba.biglobe.ne.jp> References: <9038EB93-1E0B-4870-986A-CECD34805580@kba.biglobe.ne.jp> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/6849/Sun Apr 20 17:37:54 2008 on bifrost X-Virus-Status: Clean On Sun, 20 Apr 2008 00:21:43 +0900 "Jun T." wrote: > (1) If the last character on the command line is a combining character, > and if I try to move the cursor to the end of line by vi commands > "l", "w", "$", etc., then cursor goes to the begining of the > previous line. > > This may be fixed by repacing line 1054 of zle_main.c > zlecs--; > by > DECCS(); Yes, that looks fine. > (2) If the cursor is on a combined character, vi command "x" > (vi-delete-char) deletes only the base character, leaving the > combining character (which is combined with the previous char). > > It seems this can be fixed by replacing line 359 of zle_vi.c > forekill(n, CUT_RAW); > by > forekill(n, 0); > but I don't know what the side effect of this is. > Similar change may be needed in vibackwarddeletechar(). I see what's happened here---I've assumed the case where the condition just above is true, where indeed we have a raw character count, but if it wasn't then we're deleting logical characters. Strictlly, we need to do that test better: we should see if moving forward or back the given number of times with INCPOS()/DECPOS() takes us past beginning or end of line, however as immediate surgery the following will do. Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.108 diff -u -r1.108 zle_main.c --- Src/Zle/zle_main.c 16 Apr 2008 09:59:34 -0000 1.108 +++ Src/Zle/zle_main.c 20 Apr 2008 16:49:13 -0000 @@ -1051,7 +1051,7 @@ /* for vi mode, make sure the cursor isn't somewhere illegal */ if (invicmdmode() && zlecs > findbol() && (zlecs == zlell || zleline[zlecs] == ZWC('\n'))) - zlecs--; + DECCS(); if (undoing) handleundo(); } else { Index: Src/Zle/zle_vi.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_vi.c,v retrieving revision 1.17 diff -u -r1.17 zle_vi.c --- Src/Zle/zle_vi.c 17 Apr 2008 16:18:42 -0000 1.17 +++ Src/Zle/zle_vi.c 20 Apr 2008 16:49:13 -0000 @@ -353,10 +353,14 @@ return 1; /* Put argument into the acceptable range -- it is not an error to * * specify a greater count than the number of available characters. */ - if (n > findeol() - zlecs) + /* HERE: we should do the test properly with INCPOS(). */ + if (n > findeol() - zlecs) { n = findeol() - zlecs; - /* do the deletion */ - forekill(n, CUT_RAW); + /* do the deletion */ + forekill(n, CUT_RAW); + } else { + forekill(n, 0); + } return 0; } @@ -714,10 +718,13 @@ } /* Put argument into the acceptable range -- it is not an error to * * specify a greater count than the number of available characters. */ - if (n > zlecs - findbol()) + /* HERE: we should do the test properly with DECPOS(). */ + if (n > zlecs - findbol()) { n = zlecs - findbol(); - /* do the deletion */ - backkill(n, CUT_FRONT|CUT_RAW); + /* do the deletion */ + backkill(n, CUT_FRONT|CUT_RAW); + } else + backkill(n, CUT_FRONT); return 0; } -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/