From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25353 invoked from network); 23 Feb 2005 10:51:40 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Feb 2005 10:51:40 -0000 Received: (qmail 16711 invoked from network); 23 Feb 2005 10:51:34 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Feb 2005 10:51:34 -0000 Received: (qmail 24381 invoked by alias); 23 Feb 2005 10:51:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20850 Received: (qmail 24371 invoked from network); 23 Feb 2005 10:51:29 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 23 Feb 2005 10:51:29 -0000 Received: (qmail 16419 invoked from network); 23 Feb 2005 10:51:29 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 23 Feb 2005 10:51:24 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 23 Feb 2005 10:49:54 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 23 Feb 2005 10:52:18 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j1NApMhD026285 for ; Wed, 23 Feb 2005 10:51:22 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j1NApMb3026282 for ; Wed, 23 Feb 2005 10:51:22 GMT Message-Id: <200502231051.j1NApMb3026282@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: [PATCH] fix mulibyte input/mbstate_t problem In-reply-to: <200502230020.18269.arvidjaar@newmail.ru> References: <200502230020.18269.arvidjaar@newmail.ru> Date: Wed, 23 Feb 2005 10:51:21 +0000 From: Peter Stephenson X-OriginalArrivalTime: 23 Feb 2005 10:52:18.0690 (UTC) FILETIME=[BE816620:01C51995] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.5 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.5 Andrey Borzenkov wrote: > Attached patch fixes multibyte input (verified with UTF-8). As it turns out, > mbstate_t works quite differently from expectation :) > > The patch makes it static (with implicit initialization). It is fundamentally > wrong to reinitialize it every time. mbstate_t is a function of all preceding > input; for shift state encoding it will also keep current shift state among > other things. It also means that in the long run every input must have own > mbstate_t which is initialized when stream is first opened. We need one > mbstate_t for zle. It's not quite so clear in our case. We're not just inputting a stream of characters, we've got editing characters in between. However, there's not a lot we can do apart from making consecutively typed characters work properly, so what you say is the best bet. We do probably need to reset the shift state each time zleread() is called to get a complete line, however, so the static in getrestchar() probably needs to be a global somewhere. Presumably also leaving the mbrtowc in stringaszleline separate, as it is at the moment, is also the right thing to do. > Editing Russian is funny; "echo xxxx" outputs correct text but during line > editing display is wrong (it counts every UTF-8 as 2 screen characters). If it works otherwise, e.g. the cursor moves over the right number of characters (but not screen columns), I guess that's something in zle_refresh.c. We're not using wcwidth, yet, but it doesn't sound like that's the problem since it should assume a single column per character. > BTW calling getbyte from getsrestchar resets lastchar_wide_valid. Aha, that's probably what Bart meant by "are we setting lastchar_wide_valid too early", which I misinterpreted. I'll fix it in the patch I'm doing. > PS am I the only one to have problems with SourceForge ssh CVS? It does not > hang completely but it is painfully slow. I've been having that for a day or two, too. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************