[Bash-completion-devel] Fixed competion of '~' and '~xx' in _filedir_xspec()
wonder.mice
wonder.mice at gmail.com
Sat Aug 25 15:53:50 UTC 2012
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
More information about the Bash-completion-devel
mailing list