help-zile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [zile-devel] path completion in cvs-version


From: Reuben Thomas
Subject: Re: [zile-devel] path completion in cvs-version
Date: Sun, 2 May 2004 08:12:06 +0200 (CEST)

> the current cvs version has two (little) completion problems.
> If dir->len is 0 this following code runs into an assertion
> at astr.c:60.

As far as I can see you have to have not only dir->len == 0 but also cwdir
equal to "", because that's the only condition under which astr.c:60 is
actually reached. I think the following fix should help:

> file.c:95
>         if (*sp != '/') {
>                 astr_cat_cstr(dir, cwdir);
>-                 if (*astr_char(dir, -1) != '/')
>+                 if (astr_len(dir) == 0 || *astr_char(dir, -1) != "/")
>                         astr_cat_cstr(dir, "/");
>         }

There's some problem with CVS for me at the moment, so I can't check this
in.

> The second one - which I didn't track down yet - is that
> each completion ends in "[No match]".

Got it. This was due to a very buggy "fix" of mine to directory expansion
during completion. The fix is to change the code of completion.c starting
at line 314 to be as follows:

        buf = astr_new();
        pdir = astr_new();
        fname = astr_new();

        for (i = 0; i < astr_len(as); i++){
                if (*astr_char(as, i) == '/') {
                        if (*astr_char(as, i + 1) == '/') {
                                /*
                                 * Got `//'.  Restart from this point.
                                 */
                                while (*astr_char(as, i + 1) == '/')
                                        i++;
                                astr_truncate(buf, 0);
                                /* Final '/' remains to be copied
                                   below */
                        }
                }
                astr_cat_char(buf, *astr_char(as, i));
        }
        astr_cpy(as, buf);

        agetcwd(buf);

(the very next line is an if containing a call to expand_path).

-- 
http://rrt.sc3d.org/ | God is the name of our ignorance (Grayling)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]