mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
driver: Avoid a fork in the common case.
Found-by: Matthew Martin
This commit is contained in:
parent
a868b6942e
commit
f665eec230
1 changed files with 7 additions and 1 deletions
|
|
@ -65,7 +65,13 @@ _zsh_highlight__function_is_autoload_stub_p() {
|
||||||
|
|
||||||
# Return True iff the argument denotes a function name.
|
# Return True iff the argument denotes a function name.
|
||||||
_zsh_highlight__is_function_p() {
|
_zsh_highlight__is_function_p() {
|
||||||
(( ${+functions[$1]} )) || [[ $(type -wa -- "$1") == *'function'* ]]
|
if (( ${+functions} )); then
|
||||||
|
## zsh/parameter is available
|
||||||
|
(( ${+functions[$1]} ))
|
||||||
|
else
|
||||||
|
## zsh/parameter isn't available
|
||||||
|
[[ $(type -wa -- "$1") == *'function'* ]]
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function takes a single argument F and returns True iff F denotes the
|
# This function takes a single argument F and returns True iff F denotes the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue