mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-17 12:41:14 +02:00
zsh-workers/9787
This commit is contained in:
parent
680a2161a4
commit
a76b8ea1a5
2 changed files with 41 additions and 7 deletions
|
@ -34,9 +34,9 @@ zstyle -s ":completion:${curcontext}:" substitute expr &&
|
||||||
|
|
||||||
# If the array is empty, store the original string again.
|
# If the array is empty, store the original string again.
|
||||||
|
|
||||||
[[ -z "$exp" ]] && exp=("$word")
|
(( $#exp )) || exp=("$word")
|
||||||
|
|
||||||
subd="$exp"
|
subd=("$exp[@]")
|
||||||
|
|
||||||
# Now try globbing.
|
# Now try globbing.
|
||||||
|
|
||||||
|
@ -47,14 +47,15 @@ zstyle -s ":completion:${curcontext}:" glob expr &&
|
||||||
# If we don't have any expansions or only one and that is the same
|
# If we don't have any expansions or only one and that is the same
|
||||||
# as the original string, we let other completers run.
|
# as the original string, we let other completers run.
|
||||||
|
|
||||||
[[ $#exp -eq 0 ||
|
(( $#exp )) || exp=("$subd[@]")
|
||||||
( $#exp -eq 1 && "$exp[1]" = "$word"(|\(N\)) ) ]] && return 1
|
|
||||||
|
[[ $#exp -eq 1 && "$exp[1]" = "$word"(|\(N\)) ]] && return 1
|
||||||
|
|
||||||
# With subst-globs-only we bail out if there were no glob expansions,
|
# With subst-globs-only we bail out if there were no glob expansions,
|
||||||
# regardless of any substitutions
|
# regardless of any substitutions
|
||||||
|
|
||||||
zstyle -s ":completion:${curcontext}:" subst-globs-only expr &&
|
zstyle -s ":completion:${curcontext}:" subst-globs-only expr &&
|
||||||
[[ "${(e):-\$[$expr]}" -eq 1 ]] &&
|
[[ "${(e):-\$[$expr]}" -eq 1 && "$subd" = "$exp"(|\(N\)) ]] && return 1
|
||||||
[[ "$subd" = "$exp"(|\(N\)) ]] && return 1
|
|
||||||
|
|
||||||
# Now add as matches whatever the user requested.
|
# Now add as matches whatever the user requested.
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ else
|
||||||
_requested all-expansions expl 'all expansions' "o:$word" &&
|
_requested all-expansions expl 'all expansions' "o:$word" &&
|
||||||
compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
|
compadd "$expl[@]" -UQ -qS "$suf" - "$exp"
|
||||||
|
|
||||||
if _requested expansions; then
|
if [[ $#exp -gt 1 ]] && _requested expansions; then
|
||||||
if [[ "$sort" = menu ]]; then
|
if [[ "$sort" = menu ]]; then
|
||||||
_description expansions expl expansions "o:$word"
|
_description expansions expl expansions "o:$word"
|
||||||
else
|
else
|
||||||
|
|
33
Src/utils.c
33
Src/utils.c
|
@ -2819,6 +2819,39 @@ bslashquote(const char *s, char **e, int instring)
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (*u == Tick || *u == Qtick) {
|
||||||
|
char c = *u++;
|
||||||
|
|
||||||
|
*v++ = c;
|
||||||
|
while (*u && *u != c)
|
||||||
|
*v++ = *u++;
|
||||||
|
*v++ = c;
|
||||||
|
if (!*u)
|
||||||
|
u--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if ((*u == String || *u == Qstring) &&
|
||||||
|
(u[1] == Inpar || u[1] == Inbrack || u[1] == Inbrace)) {
|
||||||
|
char c = (u[1] == Inpar ? Outpar : (u[1] == Inbrace ?
|
||||||
|
Outbrace : Outbrack));
|
||||||
|
char beg = *u;
|
||||||
|
int level = 0;
|
||||||
|
|
||||||
|
*v++ = *u++;
|
||||||
|
*v++ = *u++;
|
||||||
|
while (*u && (*u != c || level)) {
|
||||||
|
if (*u == beg)
|
||||||
|
level++;
|
||||||
|
else if (*u == c)
|
||||||
|
level--;
|
||||||
|
*v++ = *u++;
|
||||||
|
}
|
||||||
|
if (*u)
|
||||||
|
*v++ = *u;
|
||||||
|
else
|
||||||
|
u--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (ispecial(*u) &&
|
else if (ispecial(*u) &&
|
||||||
((*u != '=' && *u != '~') ||
|
((*u != '=' && *u != '~') ||
|
||||||
u == s ||
|
u == s ||
|
||||||
|
|
Loading…
Reference in a new issue