mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-03 10:21:46 +02:00
zsh-workers/8313
This commit is contained in:
parent
b852c1f6cf
commit
437294af79
5 changed files with 32 additions and 23 deletions
|
@ -60,6 +60,7 @@ comppostfuncs=()
|
|||
|
||||
_lastdescr=( "\`${(@)^_lastdescr:#}'" )
|
||||
if [[ compstate[nmatches] -eq 0 &&
|
||||
compstate[matcher] -eq compstate[total_matchers] &&
|
||||
-n "$compconfig[warning_format]" && $#_lastdescr -ne 0 ]]; then
|
||||
local str
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ for prepath in "$prepaths[@]"; do
|
|||
SUFFIX=""
|
||||
fi
|
||||
|
||||
if [[ -n $menu ]]; then
|
||||
if [[ -n $menu || "$compconfig[path_expand]" != *suffix* ]]; then
|
||||
[[ -n "$compconfig[path_cursor]" ]] && compstate[to_end]=''
|
||||
if [[ "$tmp3" = */* ]]; then
|
||||
compadd -Qf -p "$linepath${testpath:q}" -s "/${tmp3#*/}" \
|
||||
|
@ -418,7 +418,7 @@ done
|
|||
|
||||
exppaths=( "${(@)exppaths:#$orig}" )
|
||||
|
||||
if [[ -n "$compconfig[path_expand]" &&
|
||||
if [[ "$compconfig[path_expand]" = *prefix* &&
|
||||
$#exppaths -gt 0 && nm -eq compstate[nmatches] ]]; then
|
||||
PREFIX="${opre}${osuf}"
|
||||
SUFFIX=""
|
||||
|
|
|
@ -368,7 +368,7 @@ compconf() {
|
|||
|
||||
# Utility function to call a function if it exists.
|
||||
#
|
||||
# Usage: call <return> <name> [ <args> ... ]
|
||||
# Usage: funcall <return> <name> [ <args> ... ]
|
||||
#
|
||||
# If a function named <name> is defined (or defined to be autoloaded),
|
||||
# it is called. If <return> is given not the string `-' or empty, it is
|
||||
|
@ -385,10 +385,11 @@ funcall() {
|
|||
|
||||
shift
|
||||
|
||||
if builtin functions "$1"; then
|
||||
if builtin functions "$1" >& /dev/null; then
|
||||
"$@"
|
||||
_ret="$?"
|
||||
[[ -n "$_name" ]] && eval "${_name}=${_ret}"
|
||||
compstate[restore]=''
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
|
|
|
@ -720,9 +720,16 @@ from the tt(compadd) builtin.
|
|||
Finally, the tt(_path_files) function supports two configuration keys.
|
||||
startitem()
|
||||
item(tt(path_expand))(
|
||||
If this is set to any non-empty string, the partially
|
||||
If this is set to a string containing `tt(prefix)', the partially
|
||||
typed path from the line will be expanded as far as possible even if
|
||||
trailing pathname components can not be completed.
|
||||
trailing pathname components can not be completed. If it contains the
|
||||
substring `tt(suffix)' and normal (non-menu-) completion is used,
|
||||
matching names for components after the first ambiguous one will be
|
||||
added, too. This means that the resulting string is the longest
|
||||
unambiguous string possible, but if menu-completion is started on the
|
||||
list of matches generated this way (e.g. due to the option
|
||||
tt(AUTO_MENU) being set), this will also cycle through the names
|
||||
of the files in pathname components after the first ambiguous one.
|
||||
)
|
||||
item(tt(path_cursor))(
|
||||
If this is set to a non-empty string, the cursor will be left
|
||||
|
|
|
@ -4118,23 +4118,6 @@ addmatches(Cadata dat, char **argv)
|
|||
llpl -= pl;
|
||||
lpre += pl;
|
||||
}
|
||||
if (comppatmatch && *comppatmatch) {
|
||||
int is = (*comppatmatch == '*');
|
||||
char *tmp = (char *) zhalloc(2 + llpl + llsl);
|
||||
|
||||
strcpy(tmp, lpre);
|
||||
tmp[llpl] = 'x';
|
||||
strcpy(tmp + llpl + is, lsuf);
|
||||
|
||||
tokenize(tmp);
|
||||
remnulargs(tmp);
|
||||
if (haswilds(tmp)) {
|
||||
if (is)
|
||||
tmp[llpl] = Star;
|
||||
if ((cp = patcompile(tmp, 0, NULL)))
|
||||
haspattern = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Now duplicate the strings we have from the command line. */
|
||||
if (dat->ipre)
|
||||
|
@ -4196,6 +4179,23 @@ addmatches(Cadata dat, char **argv)
|
|||
else
|
||||
*argv = NULL;
|
||||
}
|
||||
if (comppatmatch && *comppatmatch) {
|
||||
int is = (*comppatmatch == '*');
|
||||
char *tmp = (char *) zhalloc(2 + llpl + llsl);
|
||||
|
||||
strcpy(tmp, lpre);
|
||||
tmp[llpl] = 'x';
|
||||
strcpy(tmp + llpl + is, lsuf);
|
||||
|
||||
tokenize(tmp);
|
||||
remnulargs(tmp);
|
||||
if (haswilds(tmp)) {
|
||||
if (is)
|
||||
tmp[llpl] = Star;
|
||||
if ((cp = patcompile(tmp, 0, NULL)))
|
||||
haspattern = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*argv) {
|
||||
if (dat->pre)
|
||||
|
|
Loading…
Reference in a new issue