Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Nazri Ramliy
On Tue, Apr 16, 2013 at 4:31 PM, Nazri Ramliy ayieh...@gmail.com wrote:
 I can reproduce this with my gvim 7.3.46 (on linux vim 7.3.892 there's no 
 problem). I'll investigate and hopefully post a fix soon.

I found the problem and the solution.

Problem summary:

expand_path_option() leaves trailing path separators after expanding the
path option. These expanded paths are passed to globpath(), which then
fed them to copy_option_part() as a comma-separated list of paths. On
windows the presence of the trailing path separator before the comma
causes copy_option_part() to not work as intended as it treats the
backslash as escaping the commas.

Solution:

Fix expand_path_option to not leave a trailing path separators when
expanding the 'path' option.

Example problem:

With 'path' set to .,,, and editing the file c:\foo\bar.txt, from the
directory c:\, and doing :find quutab, expand_path_option() expands
the .,, to:

  c:\foo\,c:\

Which is wrongly treated as a single option value by copy_option_part()

Compare the same behavior on unix:

when editing /foo/bar.txt and the current directory is /,
expand_path_option() expands the .,, to:

  /foo/,/

This is seen as two option values by copy_option_part()

Attached patch fixes this problem. It adds a test case that shows the
problem - note that the problem only happen on windows, so the test
fails on windows but ran successfully on unix.

Nazri.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




findfix.patch
Description: Binary data


Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Ingo Karkat
On 18-Apr-2013 14:14 +0200, Nazri Ramliy wrote:

 On Tue, Apr 16, 2013 at 4:31 PM, Nazri Ramliy ayieh...@gmail.com wrote:
 I can reproduce this with my gvim 7.3.46 (on linux vim 7.3.892 there's no 
 problem). I'll investigate and hopefully post a fix soon.
 
 I found the problem and the solution.
 
 Problem summary:
 
 expand_path_option() leaves trailing path separators after expanding the
 path option. These expanded paths are passed to globpath(), which then
 fed them to copy_option_part() as a comma-separated list of paths. On
 windows the presence of the trailing path separator before the comma
 causes copy_option_part() to not work as intended as it treats the
 backslash as escaping the commas.

 Solution:
 
 Fix expand_path_option to not leave a trailing path separators when
 expanding the 'path' option.

Please note that for the root directory, C:\ is different than C: (which
means the current working directory of the C drive), so leaving off the
trailing path separator may cause problems in this case. (I haven't
checked your patch, but :echo globpath('C:', '*') returns different
results than :echo globpath('C:\', '*') after :cd C:\windows.

-- regards, ingo

 Example problem:
 
 With 'path' set to .,,, and editing the file c:\foo\bar.txt, from the
 directory c:\, and doing :find quutab, expand_path_option() expands
 the .,, to:
 
   c:\foo\,c:\
 
 Which is wrongly treated as a single option value by copy_option_part()
 
 Compare the same behavior on unix:
 
 when editing /foo/bar.txt and the current directory is /,
 expand_path_option() expands the .,, to:
 
   /foo/,/
 
 This is seen as two option values by copy_option_part()
 
 Attached patch fixes this problem. It adds a test case that shows the
 problem - note that the problem only happen on windows, so the test
 fails on windows but ran successfully on unix.
 
 Nazri.


-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Christian Brabandt
On Thu, April 18, 2013 15:06, Ingo Karkat wrote:
 Please note that for the root directory, C:\ is different than C: (which
 means the current working directory of the C drive), so leaving off the
 trailing path separator may cause problems in this case. (I haven't
 checked your patch, but :echo globpath('C:', '*') returns different
 results than :echo globpath('C:\', '*') after :cd C:\windows.


That is interesting, because the echo globpath('C:', '*') result is
rather useless here:

,
|C:111.txt
|C:stats-sql.txt
|C:test.txt
`

Note the missing slash. And C: here stands for c:\temp, so the output
is rather useless in this case.

This looks like another bug here.

regards,
Christian

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Ingo Karkat
On 18-Apr-2013 15:15 +0200, Christian Brabandt wrote:

 On Thu, April 18, 2013 15:06, Ingo Karkat wrote:
 Please note that for the root directory, C:\ is different than C: (which
 means the current working directory of the C drive), so leaving off the
 trailing path separator may cause problems in this case. (I haven't
 checked your patch, but :echo globpath('C:', '*') returns different
 results than :echo globpath('C:\', '*') after :cd C:\windows.

 
 That is interesting, because the echo globpath('C:', '*') result is
 rather useless here:
 
 ,
 |C:111.txt
 |C:stats-sql.txt
 |C:test.txt
 `
 
 Note the missing slash. And C: here stands for c:\temp, so the output
 is rather useless in this case.
 
 This looks like another bug here.

No, this is just the unusual but valid notation. Without the backslash
after the drive letter, this means this path from the current working
directory of the preceding drive letter. Therefore, this works:

:cd C:\Windows
:edit C:win.ini
 Existing file opens.
:echo expand('%:p')
C:\Windows\win.ini

-- regards, ingo

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Christian Brabandt
On Thu, April 18, 2013 15:32, Ingo Karkat wrote:
 On 18-Apr-2013 15:15 +0200, Christian Brabandt wrote:

 On Thu, April 18, 2013 15:06, Ingo Karkat wrote:
 Please note that for the root directory, C:\ is different than C:
 (which
 means the current working directory of the C drive), so leaving off the
 trailing path separator may cause problems in this case. (I haven't
 checked your patch, but :echo globpath('C:', '*') returns different
 results than :echo globpath('C:\', '*') after :cd C:\windows.


 That is interesting, because the echo globpath('C:', '*') result is
 rather useless here:

 ,
 |C:111.txt
 |C:stats-sql.txt
 |C:test.txt
 `

 Note the missing slash. And C: here stands for c:\temp, so the output
 is rather useless in this case.

 This looks like another bug here.

 No, this is just the unusual but valid notation. Without the backslash
 after the drive letter, this means this path from the current working
 directory of the preceding drive letter. Therefore, this works:

 :cd C:\Windows
 :edit C:win.ini
  Existing file opens.
 :echo expand('%:p')
 C:\Windows\win.ini


I'd still prefer to have the glob return an absolute path an not such
a silly name. You can't even copy and paste that string.
Would it hurt to have globpath() in that case return an
absolute path?

regards,
Christian

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Ingo Karkat
On 18-Apr-2013 15:15 +0200, Christian Brabandt wrote:

 On Thu, April 18, 2013 15:32, Ingo Karkat wrote:
 On 18-Apr-2013 15:15 +0200, Christian Brabandt wrote:

 On Thu, April 18, 2013 15:06, Ingo Karkat wrote:
 Please note that for the root directory, C:\ is different than C:
 (which
 means the current working directory of the C drive), so leaving off the
 trailing path separator may cause problems in this case. (I haven't
 checked your patch, but :echo globpath('C:', '*') returns different
 results than :echo globpath('C:\', '*') after :cd C:\windows.


 That is interesting, because the echo globpath('C:', '*') result is
 rather useless here:

 ,
 |C:111.txt
 |C:stats-sql.txt
 |C:test.txt
 `

 Note the missing slash. And C: here stands for c:\temp, so the output
 is rather useless in this case.

 This looks like another bug here.

 No, this is just the unusual but valid notation. Without the backslash
 after the drive letter, this means this path from the current working
 directory of the preceding drive letter. Therefore, this works:

 :cd C:\Windows
 :edit C:win.ini
  Existing file opens.
 :echo expand('%:p')
 C:\Windows\win.ini

 
 I'd still prefer to have the glob return an absolute path an not such
 a silly name. You can't even copy and paste that string.
 Would it hurt to have globpath() in that case return an
 absolute path?

It's not silly, you're just not used to it! (I started with CP/M and
MS-DOS 5; maybe I have a different perspective.) It's a
fixed-drive-relative-path; you wouldn't expect ../../foo to be
copypaste-able, neither, would you?

globpath() does not return absolute paths for other more benign relative
paths such as '.', so I'm against adding a special case. Sorry. Anyway,
I'm more interested whether the proposed patch has a problem...

-- regards, ingo

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Christian Brabandt
On Thu, April 18, 2013 15:45, Ingo Karkat wrote:
 It's not silly, you're just not used to it! (I started with CP/M and
 MS-DOS 5; maybe I have a different perspective.)

That is the case. I started with MS-DOS 4.X and have never come across
that. But ok,  may be it is just my expectation.

regards,
Christian

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Nazri Ramliy
On Thu, Apr 18, 2013 at 9:06 PM, Ingo Karkat sw...@ingo-karkat.de wrote:
 Please note that for the root directory, C:\ is different than C: (which
 means the current working directory of the C drive), so leaving off the
 trailing path separator may cause problems in this case. (I haven't
 checked your patch, but :echo globpath('C:', '*') returns different
 results than :echo globpath('C:\', '*') after :cd C:\windows.

Thanks for the notice. I'll look into this again. My initial approach at
solving this was to replace all backslashes in the expanded path parts
into forward slashes but that seemed a bit too blankety of a solution
at that time.

Maybe it's not a bad idea after all.

nazri

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-18 Fir de Conversatie Nazri Ramliy
On Thu, Apr 18, 2013 at 10:11 PM, Nazri Ramliy ayieh...@gmail.com wrote:
 Thanks for the notice. I'll look into this again. My initial approach at
 solving this was to replace all backslashes in the expanded path parts
 into forward slashes but that seemed a bit too blankety of a solution
 at that time.

 Maybe it's not a bad idea after all.

Here's another attempt. This time we check if the expanded path ends
with a path separator then we replace it with forward slash, and we do
this only on windows/msdos.

Updated patch attached.

nazri

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




findfix2.patch
Description: Binary data


Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-15 Fir de Conversatie Nazri Ramliy
On Mon, Apr 15, 2013 at 1:56 PM, Nazri Ramliy ayieh...@gmail.com wrote:

 Is there anything different in my settings here that might not show the
 problem that you're seeing?


I forgot to add my vim version (it's older than yours):

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2010 17:59:02)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-46

nazri

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-15 Fir de Conversatie Suresh Govindachar

  On 4/14/2013 10:56 PM, Nazri Ramliy wrote:
   Hi Suresh!
   On Mon, Apr 15, 2013 at 10:22 AM, Suresh Govindachar 
sgovindac...@yahoo.com wrote:

  
   Hitting tab after entering a partial argument to :find will
   offer suggestions for completing the command line by searching
   inside non-trivial components of the 'path' -- but it does not
   search in . and in ,, components of the path.
  
   Here's what I see:   On vim's command line, the following finds
   the possible completions
  
 :find   ./foo/blah/blee[hit the tab key]
  
   but the following (without the leading ./) will not:
  
 :find   foo/blah/blee[hit the tab key]
  
   I'm trying to reproduce the problem but couldn't:
   My setup:

As indicated below, your setup is different from mine:

 d:\foodir /s
 (i leave out the . and .. entries to slim down the lines below)
  
  Directory of D:\foo
  
 15/04/2013  01:41 PM 9 foo.txt
 15/04/2013  01:41 PM10 food.txt
 15/04/2013  01:32 PMDIR  opt
  
  Directory of D:\foo\opt
  
 15/04/2013  01:44 PMDIR  vim
  
  Directory of D:\foo\opt\vim
  
 15/04/2013  01:32 PM11 700_vimrc
 15/04/2013  01:33 PM10 fish.txt
 15/04/2013  01:33 PM12 finger.txt
  
 d:\foogvim -u NONE -U NONE

  Start gvim from d:

 :set cp wildchar=Tab wildmode=list:longest,full
 :set path=.,,d:/foo/opt/vim,d:/foo/opt/vim/**

  My c:\opt is not below the pwd.  Anyway, for the test,
  leave path at the default value of .,,.

 :pwd
 D:\foo

  When starting from d:, :pwd will show d:\

   Now doing

In gvim, open file d:\foo\opt\vim\fish.txt

Then try the following

 :find foo[hit tab]

and

 :find *foo*[hit tab]

Thanks,

--Suresh



--
--
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

--- 
You received this message because you are subscribed to the Google Groups vim_dev group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-14 Fir de Conversatie Nazri Ramliy
Hi Suresh!

On Mon, Apr 15, 2013 at 10:22 AM, Suresh Govindachar sgovindac...@yahoo.com
wrote:
 Hitting tab after entering a partial argument to :find will offer
 suggestions for completing the command line by searching inside
 non-trivial components of the 'path' -- but it does not search in .
 and in ,, components of the path.

 Here's what I see:   On vim's command line, the following finds the
 possible completions

   :find   ./foo/blah/blee[hit the tab key]

 but the following (without the leading ./) will not:

:find   foo/blah/blee[hit the tab key]

I'm trying to reproduce the problem but couldn't:

My setup:

  d:\foodir /s
  (i leave out the . and .. entries to slim down the lines below)

   Directory of D:\foo

  15/04/2013  01:41 PM 9 foo.txt
  15/04/2013  01:41 PM10 food.txt
  15/04/2013  01:32 PMDIR  opt

   Directory of D:\foo\opt

  15/04/2013  01:44 PMDIR  vim

   Directory of D:\foo\opt\vim

  15/04/2013  01:32 PM11 700_vimrc
  15/04/2013  01:33 PM10 fish.txt
  15/04/2013  01:33 PM12 fish.txt

  d:\foogvim -u NONE -U NONE
  :set cp wildchar=Tab wildmode=list:longest,full
  :set path=.,,d:/foo/opt/vim,d:/foo/opt/vim/**
  :pwd
  D:\foo

Now doing

  :find opt/vim/fiTab

Shows fish.txt and finger.txt as the candidates.

  :find opt\vim\fish.txt

And doing

  :find *foo*

Shows foo.txt and food.txt as the candidates.

Is there anything different in my settings here that might not show the
problem that you're seeing?

Regards,

nazri

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Command line completion doesn't use . and ,, in path: Bug?

2013-04-14 Fir de Conversatie Nazri Ramliy
On Mon, Apr 15, 2013 at 1:56 PM, Nazri Ramliy ayieh...@gmail.com wrote:

   15/04/2013  01:32 PM11 700_vimrc
   15/04/2013  01:33 PM10 fish.txt
   15/04/2013  01:33 PM12 fish.txt


One of those fishes should really be a finger.txt ;)

nazri

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.