As I understand, this patch solves "Please do not expand leading tildes"
problem when _filedir_xspec is used (for vim, for example).
---
diff --git a/bash_completion b/bash_completion
index b58e37e..912a8e6 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1596,7 +1596,7 @@ _filedir_xspec()
COMPREPLY=()
_get_comp_words_by_ref cur
- _expand || return 0
+ _tilde "$cur" || return 0
# get first exclusion compspec that matches this command
xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print
\$0; exit }" \
On 08/25/2012 07:53 PM, wonder.mice wrote:
Hello,
I would like to fix issue with expanding '~' by several completion
scripts:
#489720 [m|U☹|=↝] [bash-completion] bash-completion: Please do not
expand leading tildes
#521406 [m|U☹|=↝] [bash-completion] bash-completion: leading tilde
always expanded
please do not expand leading tildes
https://bugs.launchpad.net/bash-completion/+bug/324505
As I understand, the problem is in _expand() function that is not
always correctly used.
For example, in _filedir_xspec() it expands '~' regardless to bind
-v|grep expand-tilde option.
This patch will not solve problems described above.
I'm very new in bash and completion and I want to understand that I
got right direction.
That patch fixes simple problem:
$ vim ~mi<TAB>
will not expand to
$ vim ~mice/
----
Use _tilde() to complete '~' and '~xx' like it done in _filedir().
diff --git a/bash_completion b/bash_completion
index f3488ba..beec07c 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1800,6 +1800,7 @@ _filedir_xspec()
local cur prev words cword
_init_completion || return
+ _tilde "$cur" || return 0
_expand || return 0
local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp
diff --git a/bash_completion b/bash_completion
index b58e37e..912a8e6 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1596,7 +1596,7 @@ _filedir_xspec()
COMPREPLY=()
_get_comp_words_by_ref cur
- _expand || return 0
+ _tilde "$cur" || return 0
# get first exclusion compspec that matches this command
xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" \
_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel