Skip to content

Commit

Permalink
fix: zsh completion system checks; use "(( $+… ))" instead of "(( ${#…
Browse files Browse the repository at this point in the history
……} ))" to be consitent
  • Loading branch information
LangLangBart committed Nov 9, 2024
1 parent f85ae70 commit 030c11f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions shell/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,10 @@ fzf-completion() {
setopt localoptions noshwordsplit noksh_arrays noposixbuiltins

# Check if at least one completion system (old or new) is active
if ! zmodload -e zsh/compctl || ! (( $+functions[compdef] )); then
zmodload -i zsh/compctl
if ! zmodload -F zsh/parameter p:functions 2>/dev/null || ! (( $+functions[compdef] )); then
if ! zmodload -e zsh/compctl; then
zmodload -i zsh/compctl
fi
fi
# http://zsh.sourceforge.net/FAQ/zshfaq03.html
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
Expand Down
2 changes: 1 addition & 1 deletion shell/key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fzf-history-widget() {
# Ensure the module is loaded if not already, and the required features, such
# as the associative 'history' array, which maps event numbers to full history
# lines, are set. Also, make sure Perl is installed for multi-line output.
if zmodload -F zsh/parameter p:{commands,history} 2>/dev/null && (( ${#commands[perl]} )); then
if zmodload -F zsh/parameter p:{commands,history} 2>/dev/null && (( $+commands[perl] )); then
# Import commands from other shells if SHARE_HISTORY is enabled, as the
# 'history' array only updates after executing a non-empty command.
selected="$(
Expand Down

0 comments on commit 030c11f

Please sign in to comment.