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

Re: Another _path_files bug?



On Feb 10,  8:42am, Bart Schaefer wrote:
}
} torch% setopt completeinword
} torch% ls Test/
} torch% ls Test//Test/Makefile
} 
} This only happens when there is only a single completion in the directory.
} If the completion is ambiguous, it works correctly:
} 
} The first significant difference seems to be at around line 740 - 760 of
} _path_files where, in the completeinword case, $mid gets assigned on line
} 749.  I think, but am not yet sure, that when $tsuf contains but does not
} begin with a "/", then at line 754 (and possibly also at line 752, but
} again not sure) $cpre should NOT have a trailing slash appended.

That may or may not be the case, but I've narrowed this down to the compadd
at line 783.  In the failing case, this does:

    compadd -Qf -J -default- -J -default- -p Test/ \
            -s /Makefile -W Test// -M 'r:|/=* r:|=*' - Test

That is, it's attempting to make "Test" one of the completions, and at
the same time assert that "/Makefile" should be a suffix.  The trouble
is that it's also making "Test/" a prefix (-p).

The -p argument is "${Uopt:+$IPREFIX}$linepath$tmp3/" where Uopt and
IPREFIX and linepath are all empty.  tmp3="${mid%/*/}" from line 773,
which is just $mid because "Test/" does not begin with a slash.

I think it's pretty obvious that we don't want to be treating "Test"
as both a completion and a prefix, but we need the -p option in the
event that $linepath is not empty.  Also it's not clear that the final
slash should always be appended to the -p argument as it is there.

What's the right thing to do?



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