File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -57,16 +57,13 @@ _info()
5757 _comp_unlocal IFS
5858
5959 if (( ${# COMPREPLY[@]} )) ; then
60- # weed out directory path names and paths to info pages
61- COMPREPLY=(${COMPREPLY[@]##*/ ?(: )} )
62- # weed out info dir file
63- for i in ${! COMPREPLY[*]} ; do
64- [[ ${COMPREPLY[i]} == dir ]] && unset -v ' COMPREPLY[i]'
65- done
60+ # weed out directory path names and paths to info pages (empty
61+ # elements will be removed by the later `compgen -X ''`)
62+ COMPREPLY=(" ${COMPREPLY[@]##*/ ?(: )} " )
6663 # strip suffix from info pages
67- COMPREPLY=(${COMPREPLY[@]% .@ (gz|bz2|xz|lzma)} )
68- (( ${ # COMPREPLY[@]} )) &&
69- COMPREPLY=( $( compgen -W ' "${COMPREPLY[@]%.*}"' -- " ${cur// \\\\ / } " ) )
64+ COMPREPLY=(" ${COMPREPLY[@]% .@ (gz|bz2|xz|lzma)} " )
65+ # weed out info dir file with -X 'dir'
66+ _comp_split -l COMPREPLY " $( compgen -W ' "${COMPREPLY[@]%.*}"' -X ' @(|dir) ' -- " ${cur// \\\\ / } " ) "
7067 fi
7168 fi
7269} &&
Original file line number Diff line number Diff line change @@ -85,13 +85,12 @@ _man()
8585 _comp_unlocal IFS
8686
8787 if (( ${# COMPREPLY[@]} != 0 )) ; then
88- # weed out directory path names and paths to man pages
89- COMPREPLY=(${COMPREPLY[@]##*/ ?(: )} )
88+ # weed out directory path names and paths to man pages (empty
89+ # elements will be removed by the later `compgen -X ''`)
90+ COMPREPLY=(" ${COMPREPLY[@]##*/ ?(: )} " )
9091 # strip suffix from man pages
91- (( ${# COMPREPLY[@]} )) &&
92- COMPREPLY=(${COMPREPLY[@]% $comprsuffix } )
93- (( ${# COMPREPLY[@]} )) &&
94- COMPREPLY=($( compgen -W ' "${COMPREPLY[@]%.*}"' -- " ${cur// \\\\ / } " ) )
92+ COMPREPLY=(" ${COMPREPLY[@]% $comprsuffix } " )
93+ _comp_split -l COMPREPLY " $( compgen -W ' "${COMPREPLY[@]%.*}"' -X ' ' -- " ${cur// \\\\ / } " ) "
9594 fi
9695 fi
9796
You can’t perform that action at this time.
0 commit comments