Open GoogleCodeExporter opened 8 years ago
昨天把ubuntu测试环境升到11.04,bash-completion版本号1:1.3-1ubuntu3�
��功能测试正常,没遇到上面说的多空格的问题。空格问题在
3月份bash-completion升级后出现,随后chsdir跟进修复了。是否还�
��其它人也有相同的问题?
Original comment by sha...@gmail.com
on 2 May 2011 at 4:44
% complete |grep -E "ls|cd"
可以尝试不同的 -o 选项。
Original comment by mozbug...@gmail.com
on 28 Aug 2011 at 10:05
我之前一直遇到这个问题,现在发现最新的版本已经没有问��
�,感谢你的改进
Original comment by bingmou2...@gmail.com
on 16 Sep 2011 at 2:54
似乎这个错误又出现了,在包含中文的引用的时候会出现,��
�英文的不会
例如
vi /etc/ap<TAB>
为 "vi /etc/apt/"
而 vi /media/d<TAB>
为 "vi /meida/多媒体 "
如果set -x 之后的信息为
$$:vi /media/d<TAB>
+ IFS='
'
+ COMPREPLY=()
+ _get_comp_words_by_ref cur
+ 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 cur
+ [[ 1 -ge 1 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ let 'OPTIND += 1'
+ [[ 1 -ge 2 ]]
+ __get_cword_at_cursor_by_ref '' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '' words cword
+ local exclude i j ref
+ [[ -n '' ]]
+ eval cword=1
++ cword=1
+ [[ -n '' ]]
+ eval 'words=(' '"${COMP_WORDS[@]}"' ')'
++ words=("${COMP_WORDS[@]}")
+ local i cur2
+ local 'cur=vi /media/s'
+ local index=11
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 11 -ge 2 ]]
+ [[ vi != \v\i ]]
+ [[ 0 -lt 1 ]]
+ local old_size=11
+ cur=' /media/s'
+ local new_size=9
+ index=9
+ (( ++i ))
+ (( i <= cword ))
+ [[ 9 -ge 8 ]]
+ [[ /media/ != \/\m\e\d\i\a\/\s ]]
+ cur=/media/s
+ (( index-- ))
+ [[ 8 -ge 8 ]]
+ [[ /media/s != \/\m\e\d\i\a\/\s ]]
+ [[ 1 -lt 1 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ /media/s != \/\m\e\d\i\a\/\s ]]
+ cur2=/media/s
+ local words cword cur
+ _upvars -a2 words vi /media/s -v cword 1 -v cur /media/s
+ (( 10 ))
+ (( 10 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=/media/s
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ (( 1 ))
+ local cur
+ _upvars -v cur /media/s
+ (( 3 ))
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=/media/s
+ shift 3
+ (( 0 ))
+ _expand
+ [[ /media/s == \~*/* ]]
+ [[ /media/s == \~* ]]
++ awk '/^complete[ \t]+.*[ \t]vi([ \t]|$)/ { print $0; exit }'
/etc/bash_completion
+ xspec='complete -f -X
'\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\''
vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite'
+
xspec=''\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|clas
s)'\'' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate
kwrite'
+
xspec=''\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|clas
s)'\'''
+ local -a toks
+ local tmp
+ toks=(${toks[@]-} $(
compgen -d -- "$(quote_readline "$cur")" | {
while read -r tmp; do
# see long TODO comment in _filedir() --David
printf '%s\n' $tmp
done
}
))
++ read -r tmp
+++ quote_readline /media/s
+++ local quoted
+++ _quote_readline_by_ref /media/s ret
+++ [[ / == \' ]]
+++ [[ 4 -le 3 ]]
+++ printf -v ret %q /media/s
+++ [[ / == \$ ]]
+++ printf %s /media/s
++ compgen -d -- /media/s
+ eval
'xspec='\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|clas
s)'\'''
++
xspec='*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'
+ local 'matchop=!'
+ [[ *.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class) ==
!* ]]
+ [[ 4 -ge 4 ]]
+
xspec='!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)
|*.@(O|SO|SO.!(CONF)|A|[RS]PM|GIF|JP?(E)G|MP3|MP?(E)G|AVI|ASF|OGG|CLASS))'
+ toks=(${toks[@]-} $(
eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
while read -r tmp; do
[ -n $tmp ] && printf '%s\n' $tmp
done
}
))
++ eval compgen -f -X
'!!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)|*.@(
O|SO|SO.!(CONF)|A|[RS]PM|GIF|JP?(E)G|MP3|MP?(E)G|AVI|ASF|OGG|CLASS))' --
'$(quote_readline $cur)'
++ read -r tmp
++++ quote_readline /media/s
++++ local quoted
++++ _quote_readline_by_ref /media/s ret
++++ [[ / == \' ]]
++++ [[ 4 -le 3 ]]
++++ printf -v ret %q /media/s
++++ [[ / == \$ ]]
++++ printf %s /media/s
+++ compgen -f -X
'!!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)|*.@(
O|SO|SO.!(CONF)|A|[RS]PM|GIF|JP?(E)G|MP3|MP?(E)G|AVI|ASF|OGG|CLASS))' --
/media/s
+ '[' 0 -ne 0 ']'
+ chs=($(chsdir "x$1" "$cur"))
++ chsdir xvi /media/s
+ COMPREPLY=("${toks[@]}" "${chs[@]}")
多媒体
系统为debian, 最新的testing, 版本为最新的chs_completion
Original comment by bingmou2...@gmail.com
on 23 Oct 2011 at 9:27
补充,cd不会出现这个问题,vi会出现,cat也会出现
Original comment by bingmou2...@gmail.com
on 24 Oct 2011 at 5:42
在脚本里加了调试,脚本返回给系统的时候没有多空格,应��
�是bash_completion底层代码加上的空格;
测试在 chs_completion 尾加一行,能够绕过这个问题
complete -o filenames -F _filedir_xspec vim
Original comment by sha...@gmail.com
on 17 Dec 2012 at 10:29
Original issue reported on code.google.com by
bell...@gmail.com
on 1 May 2011 at 8:52