On Sun, Jan 16, 2011 at 02:37:38PM +0100, Mirosław Zalewski wrote:
> $ ~ro<tab> # does work just fine - it gets completed into ~root
> $ ls ~ro<tab> # something is wrong here. You can press <tab> to your
> death, and it won't get completed
>
> So it does work, but not when completing argument for command (what
> perhaps most users would want to do).
Probably it's due to a change between
e5a9b6220e93ca656fd9774c6aefa78241edca6f and
f9748115fb4b2950fb4df7535fb723c4affde078 commits in the repo[1]. In
particular some changes to the bash_completion file.
Earlier in the _filedir there was:
_expand || return 0
now it looks like this:
__expand_tilde_by_ref cur
I would like to propose a patch (attached).
[1] git://git.debian.org/git/bash-completion/debian.git
--
Marcin Szewczyk http://wodny.org
mailto:[email protected] <- remove b / usuń b
xmpp:[email protected] xmpp:[email protected]
diff --git a/bash_completion b/bash_completion
index e7a4b6e..5c9483d 100644
--- a/bash_completion
+++ b/bash_completion
@@ -602,7 +602,7 @@ _filedir()
{
local i IFS=$'\t\n' xspec
- __expand_tilde_by_ref cur
+ __expand_tilde_by_ref cur || return 0
local -a toks
local quoted tmp
@@ -838,7 +838,9 @@ __expand_tilde_by_ref() {
eval $1="${!1/%\/*}"/'${!1#*/}'
else
# No, $1 doesn't contain slash
- eval $1="${!1}"
+ COMPREPLY=( $( compgen -u "${!1}" ) )
+ [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]}
+ return ${#COMPREPLY[@]}
fi
fi
} # __expand_tilde_by_ref()
_______________________________________________
Bash-completion-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel