Loading ...
Sorry, an error occurred while loading the content.
 

[patch] fixed E71 & inconsistent completion behavior with % in file names

Expand Messages
  • Dominique PellĂ©
    Hi Ex command line completion is inconsistent with what Ex commands expect when file to complete contains a % character. Example: $ cd /tmp $ echo 123
    Message 1 of 2 , May 31, 2010
      Hi

      Ex command line completion is inconsistent with what Ex commands
      expect when file to complete contains a % character.

      Example:

      $ cd /tmp
      $ echo 123 > 111%222%333
      $ echo 145 > 111%444%555

      $ vim -u NONE --noplugin -N -c 'set wildmode=longest,list'

      :e 11<Tab> completes to: :e 111\% (OK)
      :e 111\%2<Tab> -----> E71: Invalid character after \% (Not OK!)
      :e 111%2<Tab> completes to: :e 111\%222\%333
      :e 111\%222\%333<CR> --> opens the file 111%222%333 (OK)

      So for <Tab> completion to work, the % characters must not be
      preceded with backslash. However, completion itself adds the
      backslashes in from of %. It's inconsistent. The Ex command
      itself expects the backslash in front of % since % has a special
      meaning in Ex commands (:help c_%):

      I think that the correct behavior for completion should be:

      :e 111\%2<Tab> completes to: e: 111\%222\%333

      Attached patch makes it work that way, but please review it.
      I only tested on Linux.

      I noticed this bug since I have 'set undodir=~/UNDO' in my ~/.vimc.
      The ~/UNDO/ dir contains several file names with this % character and
      trying to use <Tab> completion :e ~/UNDO/<Tab> in that directory
      does not work well.

      Regards
      -- Dominique

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Bram Moolenaar
      ... Thanks. I think it s the right place to change this. I found a few more characters with problems, especially a file name foo*bar . I ll make a fix,
      Message 2 of 2 , Jun 1, 2010
        Dominique Pelle wrote:

        > Ex command line completion is inconsistent with what Ex commands
        > expect when file to complete contains a % character.
        >
        > Example:
        >
        > $ cd /tmp
        > $ echo 123 > 111%222%333
        > $ echo 145 > 111%444%555
        >
        > $ vim -u NONE --noplugin -N -c 'set wildmode=longest,list'
        >
        > :e 11<Tab> completes to: :e 111\% (OK)
        > :e 111\%2<Tab> -----> E71: Invalid character after \% (Not OK!)
        > :e 111%2<Tab> completes to: :e 111\%222\%333
        > :e 111\%222\%333<CR> --> opens the file 111%222%333 (OK)
        >
        > So for <Tab> completion to work, the % characters must not be
        > preceded with backslash. However, completion itself adds the
        > backslashes in from of %. It's inconsistent. The Ex command
        > itself expects the backslash in front of % since % has a special
        > meaning in Ex commands (:help c_%):
        >
        > I think that the correct behavior for completion should be:
        >
        > :e 111\%2<Tab> completes to: e: 111\%222\%333
        >
        > Attached patch makes it work that way, but please review it.
        > I only tested on Linux.
        >
        > I noticed this bug since I have 'set undodir=~/UNDO' in my ~/.vimc.
        > The ~/UNDO/ dir contains several file names with this % character and
        > trying to use <Tab> completion :e ~/UNDO/<Tab> in that directory
        > does not work well.

        Thanks. I think it's the right place to change this. I found a few
        more characters with problems, especially a file name "foo*bar".
        I'll make a fix, please test the version I just pushed to the vim73
        branch.

        --
        Amazing but true: If all the salmon caught in Canada in one year were laid
        end to end across the Sahara Desert, the smell would be absolutely awful.

        /// Bram Moolenaar -- Bram@... -- 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.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      Your message has been successfully submitted and would be delivered to recipients shortly.