From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9614 invoked from network); 17 Sep 2005 21:51:29 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Sep 2005 21:51:29 -0000 Received: (qmail 16360 invoked from network); 17 Sep 2005 21:51:23 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Sep 2005 21:51:23 -0000 Received: (qmail 23427 invoked by alias); 17 Sep 2005 21:51:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21732 Received: (qmail 23411 invoked from network); 17 Sep 2005 21:51:19 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Sep 2005 21:51:19 -0000 Received: (qmail 16026 invoked from network); 17 Sep 2005 21:51:19 -0000 Received: from mailgw4.technion.ac.il (132.68.238.37) by a.mx.sunsite.dk with SMTP; 17 Sep 2005 21:51:13 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgw4.technion.ac.il (Postfix) with ESMTP id E2CC0F78DE for ; Sun, 18 Sep 2005 00:35:22 +0300 (IDT) Received: from mailgw4.technion.ac.il ([127.0.0.1]) by localhost (mailgw4.technion.ac.il [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13674-01-68 for ; Sun, 18 Sep 2005 00:35:22 +0300 (IDT) Received: from fermat.math.technion.ac.il (fermat.math.technion.ac.il [132.68.115.6]) by mailgw4.technion.ac.il (Postfix) with ESMTP id BD990F78C3 for ; Sun, 18 Sep 2005 00:35:22 +0300 (IDT) Received: from fermat.math.technion.ac.il (localhost [127.0.0.1]) by fermat.math.technion.ac.il (8.12.10/8.12.10) with ESMTP id j8HLpBD6005809; Sun, 18 Sep 2005 00:51:11 +0300 (IDT) Received: (from rl@localhost) by fermat.math.technion.ac.il (8.12.10/8.12.10/Submit) id j8HLpBpQ005808; Sun, 18 Sep 2005 00:51:11 +0300 (IDT) X-Authentication-Warning: fermat.math.technion.ac.il: rl set sender to rl@math.technion.ac.il using -f Date: Sun, 18 Sep 2005 00:51:11 +0300 From: "Zvi Har'El" To: Peter Stephenson Cc: Zsh hackers list Subject: Re: problem in prompt in utf-8 Message-ID: <20050917215111.GA5756@fermat.math.technion.ac.il> References: <20050911121345.GA14384@fermat.math.technion.ac.il> <20050917181508.D63308638@pwstephenson.fsnet.co.uk> <20050917213337.4A2DB8638@pwstephenson.fsnet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1255 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20050917213337.4A2DB8638@pwstephenson.fsnet.co.uk> User-Agent: Mutt/1.4.2i Organization: Technion--Israel Institute of Technology Hebrew-Date: 14 Elul 5765 X-PGP-Public-Key: http://www.math.technion.ac.il/~rl/etc/pubkey.html X-Virus-Scanned: by amavisd-new at technion.ac.il X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) 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.0.4 On Sat, 17 Sep 2005 22:33:35 +0100, Peter Stephenson wrote about "Re: problem in prompt in utf-8": > Peter Stephenson wrote: > > This should fix the immediate problem, but note that the width of the > > prompt isn't calculated correctly yet: we don't scan prompts for > > multibyte characters. Hence you might see oddities with the display > > since the shell doesn't know the position of the cursor after the > > prompt. This is another thing on the list of fixes needed in zle. (It > > should come under the "not rocket science" heading, unlike the > > completion code, so I hope it will be fixed relatively soon.) > > Yeah. > > I think this does the trick. It relies on the fact that we usually print > out the prompt completely, so we don't need to convert it to a wide > character array, just count the characters in it. We do this because > prompts can have zero-width characters such as terminal escapes. There > was an optimisation that we could assume everything was hunky dory if > the width was the same as the length of the prompt, but I don't think > that works any more now I'm using wcwidth() for characters in the > prompt. > > This may not be rocket science, but it's not trivial either, so there > could well be glitches. > > The truncation code (stuff like "%12<...<") doesn't handle multibyte > characters properly yet. Also, I didn't put wcwidth() anywhere other > than in the prompt width calculation, so characters in the editor > buffers are still assumed to have screen width 1. Thanks Peter, I installed your two patches, and they solve all the problems I described in my email. They also solved a similar problem for other unicode characters like single quote, U+2019, which I use for directory names, like "Emperor’s New Clothes". Thanks again, Zvi. -- Dr. Zvi Har'El mailto:rl@math.technion.ac.il Department of Mathematics tel:+972-54-4227607 icq:179294841 Technion - Israel Institute of Technology fax:+972-4-8293388 http://www.math.technion.ac.il/~rl/ Haifa 32000, ISRAEL "If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942) Sunday, 14 Elul 5765, 18 September 2005, 12:47AM