From 9aa1735b63b733f062f4061975d8fa65252dee18 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 17 Feb 2000 14:12:35 +0000 Subject: zsh-workers/9776 --- Completion/Core/_main_complete | 3 +-- Src/glob.c | 9 ++++++++- Src/params.c | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index dc546d763..c7c95cfe9 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -66,8 +66,7 @@ _completers=( "$@" ) _completer_num=1 for _completer; do - _matcher="${_completer[2,-1]}-${(M)#_completers[1,_completer_num]:#$_completer}" - zstyle -a ":completion:${curcontext/::/:${_matcher}:}:" matcher-list _matchers || + zstyle -a ":completion:${curcontext/::/:${_completer[2,-1]}-${(M)#_completers[1,_completer_num]:#$_completer}:}:" matcher-list _matchers || _matchers=( '' ) _matcher_num=1 diff --git a/Src/glob.c b/Src/glob.c index 73a752536..f7c67a00f 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -1936,7 +1936,14 @@ compgetmatch(char *pat, int *flp, char **replstrp) * have one pattern at a time; we will try the must-match test ourselves, * so tell the pattern compiler we are scanning. */ - int patflags = PAT_STATIC|PAT_SCAN|PAT_NOANCH; + + /* int patflags = PAT_STATIC|PAT_SCAN|PAT_NOANCH;*/ + + /* Unfortunately, PAT_STATIC doesn't work if we have a replstr with + * something like ${x#...} in it which will be singsub()ed below because + * that would overwrite the pattern buffer. */ + + int patflags = PAT_SCAN|PAT_NOANCH | (*replstrp ? 0 : PAT_STATIC); /* * Search is anchored to the end of the string if we want to match diff --git a/Src/params.c b/Src/params.c index 52916b06f..014d0b2d4 100644 --- a/Src/params.c +++ b/Src/params.c @@ -1145,9 +1145,11 @@ getindex(char **pptr, Value v) if (*s == ']' || *s == Outbrack) s++; } else { + int com; + if (a > 0) a--; - if (*s == ',') { + if ((com = (*s == ','))) { s++; b = getarg(&s, &inv, v, 1, &dummy); if (b > 0) @@ -1157,7 +1159,7 @@ getindex(char **pptr, Value v) } if (*s == ']' || *s == Outbrack) { s++; - if (v->isarr && a == b && + if (v->isarr && a == b && !com && (!(v->isarr & SCANPM_MATCHMANY) || !(v->isarr & (SCANPM_MATCHKEY | SCANPM_MATCHVAL | SCANPM_KEYMATCH)))) -- cgit 1.4.1