[Bash-completion-devel] Fixed competion of '~' and '~xx' in _filedir_xspec()
Igor Murzov
e-mail at date.by
Wed Sep 5 14:00:01 UTC 2012
On Sun, 26 Aug 2012 16:20:37 +0400
"wonder.mice" <wonder.mice at gmail.com> wrote:
> 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 }" \
The patch does not apply. You should start your work of the 'master'
branch on git://anonscm.debian.org/bash-completion/bash-completion.git
Also, the title is not clear. Please describe what issue you are
trying to fix with this patch or submit some tests that this patch fixes.
-- Igor
> 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
>
More information about the Bash-completion-devel
mailing list