Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion bug in UTF-8 locale



Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sat, 26 Aug 2006 20:24:33 +0200
> David Gómez <david@xxxxxxxxxxxx> wrote:
> > Hi Peter,
> > I'm testing latest CVS and the completion bug is still present. My locale
> > is different from Roman's one (es_ES.UTF-8) and my tests are with japanese
> > characters:
> > 
> > [~] % ls 花 
> > aaaa  bbbb
> > 
> > And 
> > 
> > [~] % cd 花/<Tab>
> > 
> > doesn't complete.
> 
> Is this after plain "zsh -f"?  I can see the problem there, although I
> may not have a chance to look at it for a while since I'm in the middle
> of some holiday (it's probably a fairly trivial missing piece of Meta
> handling again).

This fixes the problem in this case, although I still don't know if this is
the only problem.  This isn't new with MULTIBYTE_SUPPORT, although in the
case of this character you'd be seeing other strange effects if you didn't
have that turned on.

Index: Src/Zle/compctl.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compctl.c,v
retrieving revision 1.27
diff -u -r1.27 compctl.c
--- Src/Zle/compctl.c	30 May 2006 22:35:04 -0000	1.27
+++ Src/Zle/compctl.c	30 Aug 2006 15:50:33 -0000
@@ -2127,9 +2127,9 @@
 {
     DIR *d;
     struct stat buf;
-    char *n, p[PATH_MAX], *q = NULL, *e;
+    char *n, p[PATH_MAX], *q = NULL, *e, *pathpref;
     LinkList l = NULL;
-    int ns = 0, ng = opts[NULLGLOB], test, aw = addwhat;
+    int ns = 0, ng = opts[NULLGLOB], test, aw = addwhat, pathpreflen;
 
     opts[NULLGLOB] = 1;
 
@@ -2145,12 +2145,18 @@
 	all = execs = 0;
     }
     /* Open directory. */
-    if ((d = opendir((prpre && *prpre) ? prpre : "."))) {
+    if (prpre && *prpre) {
+	pathpref = dupstring(prpre);
+	unmetafy(pathpref, &pathpreflen);
+    } else {
+	pathpref = NULL;
+	pathpreflen = 0;
+    }
+    if ((d = opendir(pathpref ? pathpref : "."))) {
 	/* If we search only special files, prepare a path buffer for stat. */
-	if (!all && prpre) {
-	    strcpy(p, prpre);
-	    q = p + strlen(prpre);
-	}
+	if (!all && pathpreflen)
+	    memcpy(p, pathpref, pathpreflen);
+	q = p + pathpreflen;
 	/* Fine, now read the directory. */
 	while ((n = zreaddir(d, 1)) && !errflag) {
 	    /* Ignore files beginning with `.' unless the thing we found on *

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



Messages sorted by: Reverse Date, Date, Thread, Author