mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-08 12:01:21 +02:00
make _oldlist ignore list from _complete_help; _match runs for every match spec from matcher-list; _approximate doesn't redefine compadd if that is already a function (10641)
This commit is contained in:
parent
2fcab2a716
commit
3d0f90ba2b
4 changed files with 28 additions and 16 deletions
|
@ -1,5 +1,11 @@
|
||||||
2000-04-11 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
2000-04-11 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
||||||
|
|
||||||
|
* 10641: Completion/Core/_approximate, Completion/Core/_match,
|
||||||
|
Completion/Core/_oldlist: make _oldlist ignore list from
|
||||||
|
_complete_help; _match runs for every match spec from
|
||||||
|
matcher-list; _approximate doesn't redefine compadd if that is
|
||||||
|
already a function
|
||||||
|
|
||||||
* 10635: Completion/User/_make: _make uses $words[1] for command
|
* 10635: Completion/User/_make: _make uses $words[1] for command
|
||||||
name
|
name
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
[[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
|
[[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
|
||||||
|
|
||||||
local _comp_correct _correct_expl comax cfgacc
|
local _comp_correct _correct_expl comax cfgacc redef
|
||||||
local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
|
local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
|
||||||
|
|
||||||
zstyle -s ":completion:${curcontext}:" max-errors cfgacc || cfgacc='2 numeric'
|
zstyle -s ":completion:${curcontext}:" max-errors cfgacc || cfgacc='2 numeric'
|
||||||
|
@ -40,17 +40,20 @@ _tags corrections original
|
||||||
# to stick the `(#a...)' in the right place (after an
|
# to stick the `(#a...)' in the right place (after an
|
||||||
# ignored prefix).
|
# ignored prefix).
|
||||||
|
|
||||||
compadd() {
|
if (( ! $+functions[compadd] )); then
|
||||||
[[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
|
redef=yes
|
||||||
"${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
|
compadd() {
|
||||||
|
[[ ${argv[(I)-[a-zA-Z]#U[a-zA-Z]#]} -eq 0 &&
|
||||||
|
"${#:-$PREFIX$SUFFIX}" -le _comp_correct ]] && return
|
||||||
|
|
||||||
if [[ "$PREFIX" = \~*/* ]]; then
|
if [[ "$PREFIX" = \~*/* ]]; then
|
||||||
PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
|
PREFIX="${PREFIX%%/*}/(#a${_comp_correct})${PREFIX#*/}"
|
||||||
else
|
else
|
||||||
PREFIX="(#a${_comp_correct})$PREFIX"
|
PREFIX="(#a${_comp_correct})$PREFIX"
|
||||||
fi
|
fi
|
||||||
builtin compadd "$_correct_expl[@]" "$@"
|
builtin compadd "$_correct_expl[@]" "$@"
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
_comp_correct=1
|
_comp_correct=1
|
||||||
|
|
||||||
|
@ -81,7 +84,7 @@ while [[ _comp_correct -le comax ]]; do
|
||||||
[[ "$compstate[list]" != list* ]] &&
|
[[ "$compstate[list]" != list* ]] &&
|
||||||
compstate[list]="$compstate[list] force"
|
compstate[list]="$compstate[list] force"
|
||||||
fi
|
fi
|
||||||
unfunction compadd
|
[[ -n "$redef" ]] && unfunction compadd
|
||||||
compstate[pattern_match]="$opm"
|
compstate[pattern_match]="$opm"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -91,7 +94,7 @@ while [[ _comp_correct -le comax ]]; do
|
||||||
(( _comp_correct++ ))
|
(( _comp_correct++ ))
|
||||||
done
|
done
|
||||||
|
|
||||||
unfunction compadd
|
[[ -n "$redef" ]] && unfunction compadd
|
||||||
compstate[pattern_match]="$opm"
|
compstate[pattern_match]="$opm"
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# expand-or-complete function because otherwise the pattern will
|
# expand-or-complete function because otherwise the pattern will
|
||||||
# be expanded using globbing.
|
# be expanded using globbing.
|
||||||
|
|
||||||
[[ _matcher_num -gt 1 ]] && return 1
|
### Shouldn't be needed any more: [[ _matcher_num -gt 1 ]] && return 1
|
||||||
|
|
||||||
local tmp opm="$compstate[pattern_match]" ret=0 orig ins
|
local tmp opm="$compstate[pattern_match]" ret=0 orig ins
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ zstyle -s ":completion:${curcontext}:" old-list list
|
||||||
# Do this also if there is an old list and it was generated by the
|
# Do this also if there is an old list and it was generated by the
|
||||||
# completer named by the oldlist_list key.
|
# completer named by the oldlist_list key.
|
||||||
|
|
||||||
if [[ -n $compstate[old_list] && $list != never ]]; then
|
if [[ -n $compstate[old_list] && $list != never &&
|
||||||
|
$LASTWIDGET != _complete_help ]]; then
|
||||||
if [[ $WIDGET = *list* && ( $list = always || $list != shown ) ]]; then
|
if [[ $WIDGET = *list* && ( $list = always || $list != shown ) ]]; then
|
||||||
compstate[old_list]=keep
|
compstate[old_list]=keep
|
||||||
return 0
|
return 0
|
||||||
|
@ -33,8 +34,10 @@ fi
|
||||||
# and the style :oldlist:old-menu is `true', then we cycle through the
|
# and the style :oldlist:old-menu is `true', then we cycle through the
|
||||||
# existing list (even if it was generated by another widget).
|
# existing list (even if it was generated by another widget).
|
||||||
|
|
||||||
if [[ -z $compstate[old_insert] && -n $compstate[old_list] ]]; then
|
if [[ -z $compstate[old_insert] && -n $compstate[old_list] &&
|
||||||
|
$LASTWIDGET != _complete_help ]]; then
|
||||||
compstate[old_list]=keep
|
compstate[old_list]=keep
|
||||||
|
return 0
|
||||||
elif [[ $WIDGET = *complete(|-prefix|-word) ]] &&
|
elif [[ $WIDGET = *complete(|-prefix|-word) ]] &&
|
||||||
zstyle -t ":completion:${curcontext}:" old-menu; then
|
zstyle -t ":completion:${curcontext}:" old-menu; then
|
||||||
if [[ -n $compstate[old_insert] ]]; then
|
if [[ -n $compstate[old_insert] ]]; then
|
||||||
|
|
Loading…
Reference in a new issue