mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
23363: fake-files now allows patterns
This commit is contained in:
parent
5f13656d7f
commit
19dccc355a
4 changed files with 27 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2007-05-01 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 23363: README (not posted), Doc/Zsh/compsys.yo,
|
||||
Src/Zle/computil.c: fake-files style now takes pattern.
|
||||
|
||||
2007-04-30 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 23339: Src/mem.c: make malloc(0) allocate a single byte
|
||||
|
|
|
@ -1340,12 +1340,17 @@ without a tag. Its values are of the form
|
|||
`var(dir)tt(:)var(names...)'. This will add the var(names) (strings
|
||||
separated by spaces) as
|
||||
possible matches when completing in the directory var(dir), even if no
|
||||
such files really exist.
|
||||
such files really exist. The dir may be a pattern; pattern characters
|
||||
or colons in var(dir) should be quote with a backslash to be treated
|
||||
literally.
|
||||
|
||||
This can be useful on systems that support special filesystems whose
|
||||
top-level pathnames can not be listed or generated with glob patterns.
|
||||
It can also be used for directories for which one does not have read
|
||||
permission.
|
||||
|
||||
The pattern form can be used to add a certain `magic' entry
|
||||
to all directories on a particular filing system.
|
||||
)
|
||||
kindex(fake-parameters, completion style)
|
||||
item(tt(fake-parameters))(
|
||||
|
|
5
README
5
README
|
@ -104,6 +104,11 @@ change was necessary because otherwise recursive directories under
|
|||
hit for anyone not using PINE. The previous default can be restored with:
|
||||
zstyle ':completion:*' pine-directory ~/mail
|
||||
|
||||
The completion style fake-files now allows patterns as directories,
|
||||
for example the value '/home/*:.snapshot' is now valid. This will
|
||||
only cause problems in the unlikely event that a directory in the style
|
||||
has a pattern character in it.
|
||||
|
||||
The default maximum function depth (configurable with
|
||||
--enable-max-function-depth) has been decreased to 1000 from 4096. The
|
||||
previous value was observed to be large enough that crashes still occurred
|
||||
|
|
|
@ -4247,14 +4247,20 @@ cfp_add_sdirs(LinkList final, LinkList orig, char *skipped,
|
|||
char *m, *f, *p, *t, *a, c;
|
||||
int sl = strlen(skipped) + 1;
|
||||
struct stat st1, st2;
|
||||
Patprog pprog;
|
||||
|
||||
for (; (f = *fake); fake++) {
|
||||
f = dupstring(f);
|
||||
for (p = t = f; *p; p++) {
|
||||
if (*p == ':')
|
||||
break;
|
||||
else if (*p == '\\' && p[1])
|
||||
else if (*p == '\\' && p[1] == ':') {
|
||||
/*
|
||||
* strip quoted colons here; rely
|
||||
* on tokenization to strip other backslashes
|
||||
*/
|
||||
p++;
|
||||
}
|
||||
*t++ = *p;
|
||||
}
|
||||
if (*p) {
|
||||
|
@ -4262,9 +4268,12 @@ cfp_add_sdirs(LinkList final, LinkList orig, char *skipped,
|
|||
if (!*p)
|
||||
continue;
|
||||
|
||||
tokenize(f);
|
||||
pprog = patcompile(f, PAT_STATIC, NULL);
|
||||
untokenize(f);
|
||||
for (node = firstnode(orig); node; incnode(node)) {
|
||||
if ((m = (char *) getdata(node)) &&
|
||||
(!strcmp(f, m) ||
|
||||
((pprog ? pattry(pprog, m) : !strcmp(f, m)) ||
|
||||
(!stat(f, &st1) && !stat((*m ? m : "."), &st2) &&
|
||||
st1.st_dev == st2.st_dev &&
|
||||
st1.st_ino == st2.st_ino))) {
|
||||
|
|
Loading…
Reference in a new issue