Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion bug in UTF-8 locale
- X-seq: zsh-workers 22651
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx, Roman Cheplyaka <roman.cheplyaka@xxxxxxxxx>
- Subject: Re: completion bug in UTF-8 locale
- Date: Sun, 20 Aug 2006 23:18:38 +0100
- In-reply-to: <20060820200808.GA4049@localdomain>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20060820071833.GA3850@localdomain> <20060820180151.6b23348c.p.w.stephenson@xxxxxxxxxxxx> <20060820200808.GA4049@localdomain>
On Sun, 20 Aug 2006 23:08:08 +0300
Roman Cheplyaka <roman.cheplyaka@xxxxxxxxx> wrote:
> I've made some more tests. It seems to break at certain letters.. Try for
> example directory named "ц" (w/o quotes).
Aha. That needs one of the bytes to be encoded as a "Meta" byte (it
overlaps with zsh's range of internal tokens).
That's still broken in the patches I made for listing multibyte
characters quite recently; the following should fix it. This means it's
not surprising it's buggy in 4.3.2.
Would you be able to try it with the code currently in CVS? Otherwise
I'll probably make a pre-4.3.3 test version shortly.
In the following patch I've assumed that any null-terminated string must
be metafied. That's the usual rule, but nothing would surprise me about
the completion code.
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.94
diff -u -r1.94 complist.c
--- Src/Zle/complist.c 17 Aug 2006 09:34:12 -0000 1.94
+++ Src/Zle/complist.c 20 Aug 2006 22:17:13 -0000
@@ -621,7 +621,11 @@
if (ml == mlend - 1 && (cc % columns) == columns - 1)
return 0;
- putc(*p, shout);
+ if (*p == Meta) {
+ p++;
+ putc(*p ^ 32, shout);
+ } else
+ putc(*p, shout);
if ((beg = !(cc % columns)))
ml++;
if (mscroll && !(cc % columns) &&
@@ -1137,8 +1141,14 @@
dopr = 0;
continue;
}
- while (len--)
- putc(*p++, shout);
+ while (len--) {
+ if (*p == Meta) {
+ len--;
+ p++;
+ putc(*p++ ^ 32, shout);
+ } else
+ putc(*p++, shout);
+ }
if ((beg = !(cc % columns)) && !stat) {
ml++;
fputs(" \010", shout);
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.74
diff -u -r1.74 zle_tricky.c
--- Src/Zle/zle_tricky.c 20 Aug 2006 18:07:49 -0000 1.74
+++ Src/Zle/zle_tricky.c 20 Aug 2006 22:17:15 -0000
@@ -2123,9 +2123,15 @@
tcout(TCUNDERLINEEND);
break;
case '{':
- for (p++; *p && (*p != '%' || p[1] != '}'); p++)
- if (dopr)
+ for (p++; *p && (*p != '%' || p[1] != '}'); p++) {
+ if (*p == Meta) {
+ p++;
+ if (dopr)
+ putc(*p ^ 32, shout);
+ }
+ else if (dopr)
putc(*p, shout);
+ }
if (*p)
p++;
else
@@ -2164,8 +2170,14 @@
convchar_t cchar;
int clen = MB_METACHARLENCONV(p, &cchar);
if (dopr) {
- while (clen--)
- putc(*p++, shout);
+ while (clen--) {
+ if (*p == Meta) {
+ p++;
+ clen--;
+ putc(*p++ ^ 32, shout);
+ } else
+ putc(*p++, shout);
+ }
} else
p += clen;
cc += WCWIDTH(cchar);
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author