You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix bash completion when the user has changed $IFS
Like in the Korn shell, "${COMP_WORDS[*]}" in bash joins the elements of
the array with the first character of $IFS, and $(...) and $1 unquoted
cause their expansion to be split on characters of $IFS (and be
subjected to globbing).
Here, we want the COMP_WORDS elements to be joined with space characters
and $(...) to be split on space (and possibly tab and newline in the
future) like with the default value of $IFS (or when $IFS is unset).
So we set IFS locally to space+tab+newline (better than "local IFS"
alone which would only make IFS unset in the function if the
localvar_inherit option was not enabled (bash has no equivalent of
zsh's "emulate -L zsh" to have default option settings locally in a
function)).
Globbing is still performed on the resulting words (unless the user
enabled the noglob option), which is still a problem for instance when
we offer file or directory completions when files/directories paths
contain wildcard characters, but then again at the moment any character
special in the syntax of the shell (including wildcards, space, ;|()<>
etc) are a problem anyway as we don't quote them like bash's default
file completion does, so it's probably not worth fixing until that other
issue is addressed. At the moment pip's file completion only works
properly on very tame file names.
The ash-style "local -; set -o noglob" which would be the obvious fix
for that wouldn't work with the ancient version of bash found on macos.
0 commit comments