Filename completion broken in Vim 7.1.82

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Filename completion broken in Vim 7.1.82

Yegappan Lakshmanan

Hi all,

It looks like filename completion in the command-line mode is broken
in Vim 7.1.82. I am running Vim 7.1.82 on Linux and see the following
issue.

    $ cd vim7/src
    $ vim
    :edit *unix*<Tab>

When I press <Tab> to complete the name of files containing the string
"unix" in them, it completes all the files in the current directory.
It appears the specified pattern is ignored. Is anyone else seeing this
problem?

- Yegappan

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Martin Toft
On Sat, Aug 18, 2007 at 10:29:04PM -0700, Yegappan Lakshmanan wrote:

> Hi all,
>
> It looks like filename completion in the command-line mode is broken
> in Vim 7.1.82. I am running Vim 7.1.82 on Linux and see the following
> issue.
>
>     $ cd vim7/src
>     $ vim
>     :edit *unix*<Tab>
>
> When I press <Tab> to complete the name of files containing the string
> "unix" in them, it completes all the files in the current directory.
> It appears the specified pattern is ignored. Is anyone else seeing
> this problem?
It is introduced by patch 7.1.081 [1], which is supposed to fix this
bug:

- Command line completion for a shell command: "cat </tmp/file<Tab>"
  doesn't work.

In co-operation with Bram, I decided to make vim_isfilec() the judge of
which characters to treat as white space when doing shell completion.
We didn't think of your example ('*unix*<Tab>'), sorry.

I'll wait and see what Bram (or others) proposes as a solution.

Martin

[1] ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.081

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Bram Moolenaar
In reply to this post by Yegappan Lakshmanan


Yegappan Lakshmanan wrote:

> It looks like filename completion in the command-line mode is broken
> in Vim 7.1.82. I am running Vim 7.1.82 on Linux and see the following
> issue.
>
>     $ cd vim7/src
>     $ vim
>     :edit *unix*<Tab>
>
> When I press <Tab> to complete the name of files containing the string
> "unix" in them, it completes all the files in the current directory.
> It appears the specified pattern is ignored. Is anyone else seeing this
> problem?

Yeah, that's an obvious mistake in patch 7.1.081.  I suggested using
isfname(), but forgot about the wildcards.  I expect Martin to fix it.

--
Some of the well know MS-Windows errors:
        EMEMORY Memory error caused by..., eh...
        ELICENSE Your license has expired, give us more money!
        EMOUSE Mouse moved, reinstall Windows
        EILLEGAL Illegal error, you are not allowed to see this
        EVIRUS Undetectable virus found

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Bram Moolenaar
In reply to this post by Martin Toft


Martin Toft wrote:

> On Sat, Aug 18, 2007 at 10:29:04PM -0700, Yegappan Lakshmanan wrote:
> > Hi all,
> >
> > It looks like filename completion in the command-line mode is broken
> > in Vim 7.1.82. I am running Vim 7.1.82 on Linux and see the following
> > issue.
> >
> >     $ cd vim7/src
> >     $ vim
> >     :edit *unix*<Tab>
> >
> > When I press <Tab> to complete the name of files containing the string
> > "unix" in them, it completes all the files in the current directory.
> > It appears the specified pattern is ignored. Is anyone else seeing
> > this problem?
>
> It is introduced by patch 7.1.081 [1], which is supposed to fix this
> bug:
>
> - Command line completion for a shell command: "cat </tmp/file<Tab>"
>   doesn't work.
>
> In co-operation with Bram, I decided to make vim_isfilec() the judge of
> which characters to treat as white space when doing shell completion.
> We didn't think of your example ('*unix*<Tab>'), sorry.
>
> I'll wait and see what Bram (or others) proposes as a solution.

My proposal is that you fix it :-)  We have mch_has_wildcard(), but it
applies to a whole string, so you need to do some more work.

--
Spam seems to be something useful to novices.  Later you realize that
it's a bunch of indigestable junk that only clogs your system.
Applies to both the food and the e-mail!

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Martin Toft
On Sun, Aug 19, 2007 at 05:52:56PM +0200, Bram Moolenaar wrote:
> My proposal is that you fix it :-)  We have mch_has_wildcard(), but it
> applies to a whole string, so you need to do some more work.

Okidoki :-)

I'm sorry to be slow, but my parents suddenly decided to pay me a visit,
and you don't say no to a free meal :-)  (they brought it with them...)

Here is a patch for the problem.  Everybody on the list is very welcome
to test it and comment on it!

I had to cheat a bit with regard to ']', as we want to be able to
':e [a-z]<Tab>' etc., and mch_has_wildcard("]") returns false.

Thanks to Yegappan Lakshmanan for reporting the bug.

Martin

command_line_shell_completion_wildcards.patch.txt (2K) Download Attachment
signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Bram Moolenaar


Martin Toft wrote:

> On Sun, Aug 19, 2007 at 05:52:56PM +0200, Bram Moolenaar wrote:
> > My proposal is that you fix it :-)  We have mch_has_wildcard(), but it
> > applies to a whole string, so you need to do some more work.
>
> Okidoki :-)
>
> I'm sorry to be slow, but my parents suddenly decided to pay me a visit,
> and you don't say no to a free meal :-)  (they brought it with them...)

And now the software is starving... :-).

> Here is a patch for the problem.  Everybody on the list is very welcome
> to test it and comment on it!
>
> I had to cheat a bit with regard to ']', as we want to be able to
> ':e [a-z]<Tab>' etc., and mch_has_wildcard("]") returns false.
>
> Thanks to Yegappan Lakshmanan for reporting the bug.

Good catch with "]".  By itself it's not recognized, only the matching
"[" is.

How about making a bit cleaner:  You are overwriting the string and
restoring the character in four places.  If we make a
vim_isfilec_or_wc() function that could be simplified a lot.  You can
safely assume that a wildcard char is not multi-byte.  Thus putting the
byte in a two-byte buffer and then invoking mch_has_wildcard() should be
OK.

--
hundred-and-one symptoms of being an internet addict:
204. You're being audited because you mailed your tax return to the IRC.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Martin Toft
On Sun, Aug 19, 2007 at 09:11:41PM +0200, Bram Moolenaar wrote:
> Good catch with "]".  By itself it's not recognized, only the matching
> "[" is.
>
> How about making a bit cleaner:  You are overwriting the string and
> restoring the character in four places.  If we make a
> vim_isfilec_or_wc() function that could be simplified a lot.  You can
> safely assume that a wildcard char is not multi-byte.  Thus putting
> the byte in a two-byte buffer and then invoking mch_has_wildcard()
> should be OK.

Thanks for the feedback.  The patch worked but it was kind of messy.  It
illustrated quite well that comments starts to appear when the code no
longer speaks for itself.

I have attached a cleaner patch.

Martin

command_line_shell_completion_wildcards.patch.txt (3K) Download Attachment
signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Filename completion broken in Vim 7.1.82

Bram Moolenaar


Martin Toft wrote:

> On Sun, Aug 19, 2007 at 09:11:41PM +0200, Bram Moolenaar wrote:
> > Good catch with "]".  By itself it's not recognized, only the matching
> > "[" is.
> >
> > How about making a bit cleaner:  You are overwriting the string and
> > restoring the character in four places.  If we make a
> > vim_isfilec_or_wc() function that could be simplified a lot.  You can
> > safely assume that a wildcard char is not multi-byte.  Thus putting
> > the byte in a two-byte buffer and then invoking mch_has_wildcard()
> > should be OK.
>
> Thanks for the feedback.  The patch worked but it was kind of messy.  It
> illustrated quite well that comments starts to appear when the code no
> longer speaks for itself.
>
> I have attached a cleaner patch.

Much cleaner, thanks.

--
hundred-and-one symptoms of being an internet addict:
209. Your house stinks because you haven't cleaned it in a week.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---