Description
Describe the bug
With no_empty_cmd_completion
off, empty commandlines get no completion, but empty commands in non-empty commandlines do. In particular, this made me think #978 didn't exist -- I'd transpose typing a tab with the first letter of a command after a semicolon, which would trigger command search.
To reproduce
$ shopt -u no_empty_cmd_completion
On an empty command line, press <tab>
to attempt to trigger command completion -- nothing happens. That is (with prompt $
):
$ <tab>
does nothing. However
$ <tab>
and
$ ; <tab>
both trigger completion, as expected.
And of course, with shopt -s no_empty_cmd_completion
, all three don't trigger completion.
Expected behavior
$ <tab>
should trigger completion with no_empty_cmd_completion
off.
Ideally, this sensitivity to TIL about no_empty_cmd_completion
should be documented somewhere other than the sourcedoc/configuration.md
, and that my system's bash-completion
doesn't ship the documentation.
Versions (please complete the following information)
- Operating system name/distribution and version: Arch Linux 6.11.5-arch1-1
- bash version,
echo "$BASH_VERSION"
: 5.2.37(1)-release - bash-completion version,
(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
: 2.13.0 (though in actualitybash-completion-git 2.13.0.r36.gc4885485-1
-- ie built off c488548)
Debug trace
(with bash --rcfile /etc/bash.bashrc; set -x; set -v
to clean the logs)
[gesh@telcontar ~]$ + local cur prev words cword comp_args
+ _comp_initialize -- _EmptycmD_ '' ''
+ local exclude= opt_split= outx= errx= inx=
+ local flag OPTIND=1 OPTARG= OPTERR=0
+ getopts n:e:o:i:s flag -- _EmptycmD_ '' ''
+ shift 1
+ (( 3 ))
+ comp_args=("$@")
+ COMPREPLY=()
+ local 'redir=@(?(+([0-9])|{[a-zA-Z_]*([a-zA-Z_0-9])})@(>?([>|&])|<?([>&])|<<?([-<]))|&>?(>))'
+ _comp_get_words -n '<>&' cur prev words cword
+ local exclude= flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur= vcword= vprev= vwords=
+ getopts c:i:n:p:w: flag -n '<>&' cur prev words cword
+ case $flag in
+ exclude='<>&'
+ getopts c:i:n:p:w: flag -n '<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ (( OPTIND += 1 ))
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ (( OPTIND += 1 ))
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ (( OPTIND += 1 ))
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ (( OPTIND += 1 ))
+ [[ 6 -ge 7 ]]
+ _comp__get_cword_at_cursor '<>&' words cword cur
+ words=()
+ local cword words
+ _comp__reassemble_words '<>&' words cword
+ local exclude= i j line ref
+ [[ -n <>& ]]
+ exclude='[<>&]'
+ printf -v cword %s -1
+ [[ -n [<>&] ]]
+ line=
+ (( i = 0, j = 0 ))
+ (( i < 0 ))
+ (( i == COMP_CWORD ))
+ local i cur= index=0 lead=
+ [[ 0 -gt 0 ]]
+ local 'IFS=
'
+ local words cword cur
+ _comp_upvars -a0 words -v cword -1 -v cur ''
+ (( 8 ))
+ (( 8 ))
+ case $1 in
+ [[ -n 0 ]]
+ printf %d 0
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:0}")'
words=("${@:3:0}")
++ words=("${@:3:0}")
+ shift 2
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
cword="$3"
++ cword=-1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
cur="$3"
++ cur=
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v "$vcur" "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v "$vcword" "$cword")
+ [[ -n prev ]]
+ local value=
+ (( cword >= 1 ))
+ upvars+=("$vprev")
+ upargs+=(-v "$vprev" "$value")
+ [[ -n words ]]
+ local 'IFS=
'
+ upvars+=("$vwords")
+ upargs+=(-a"${#words[@]}" "$vwords" ${words+"${words[@]}"})
+ (( 4 ))
+ local cur cword prev words
+ _comp_upvars -v cur '' -v cword -1 -v prev '' -a0 words
+ (( 11 ))
+ (( 11 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
cur="$3"
++ cur=
+ shift 3
+ (( 8 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
cword="$3"
++ cword=-1
+ shift 3
+ (( 5 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
prev="$3"
++ prev=
+ shift 3
+ (( 2 ))
+ case $1 in
+ [[ -n 0 ]]
+ printf %d 0
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:0}")'
words=("${@:3:0}")
++ words=("${@:3:0}")
+ shift 2
+ (( 0 ))
+ _comp_compgen_variables
+ [[ '' =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]
+ [[ '' =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]
+ [[ '' =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*]$ ]]
+ return 1
+ [[ '' == @(?(+([0-9])|{[a-zA-Z_]*([a-zA-Z_0-9])})@(>?([>|&])|<?([>&])|<<?([-<]))|&>?(>))* ]]
+ [[ '' == @(?(+([0-9])|{[a-zA-Z_]*([a-zA-Z_0-9])})@(>?([>|&])|<?([>&])|<<?([-<]))|&>?(>)) ]]
+ local i skip
+ (( i = 1 ))
+ (( i < 0 ))
+ (( cword <= 0 ))
+ return 1
+ return
Attempting to produce logs for $ ; <tab>
fails -- I immediately get prompted:
[gesh@telcontar ~]$ ;
Display all 4449 possibilities? (y or n)