Skip to content
Myr

[bash-completion] Fix endless loop when completion.bash sourced twice

Before adoption: this commit came in with the history the project adopted, so no landing records it.

I forgot to add the "not _fzf" check into __fzf_orig_completion, so invoking it twice would rewrite the _fzf_orig_completion_xxx variables and then cause an endless loop when completion is requested.

authored by Tomas Janousek · committed by Junegunn Choi · parent 75b8cca · Browse files · 1 file+1 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Fixes: ef2c29d5d497 ("[bash-completion] Optimize __fzf_orig_completion_filter")

Diff stats

1 file+1 added−0 removed

  • other:+1 added−0 removed

1 file+1 added−0 removed

modified:shell/completion.bash+1 added
51 unmodified lines
52 if [[ "$l" =~ ^(.*\ -F)\ *([^ ]*).*\ ([^ ]*)$ ]]; then53 comp="${BASH_REMATCH[1]}"54 f="${BASH_REMATCH[2]}"55 cmd="${BASH_REMATCH[3]}"56 [[ "$f" = _fzf_* ]] && continue57 printf -v "_fzf_orig_completion_${cmd//[^A-Za-z0-9_]/_}" "%s" "${comp} %s ${cmd} #${f}"58 if [[ "$l" = *" -o nospace "* ]] && [[ ! "$__fzf_nospace_commands" = *" $cmd "* ]]; then59 __fzf_nospace_commands="$__fzf_nospace_commands $cmd "60 fi
321 unmodified lines