Patch 8.0.1426
Problem: "gf" and <cfile> don't accept ? and & in URL. (Dmitrii Tcyganok)
Solution: Check for a URL and allow for extra characters. (closes #2493)
Files: src/window.c, src/testdir/test_gf.vim
*** ../vim-8.0.1425/src/window.c 2017-12-05 20:31:02.520899063 +0100
--- src/window.c 2017-12-25 14:25:10.192459557 +0100
***************
*** 6081,6087 ****
count, curbuf->b_ffname);
}
return file_name_at_cursor(options | FNAME_HYP, count, file_lnum);
-
}
/*
--- 6081,6086 ----
***************
*** 6120,6125 ****
--- 6119,6126 ----
{
char_u *ptr;
int len;
+ int in_type = TRUE;
+ int is_url = FALSE;
/*
* search forward for what could be the start of a file name
***************
*** 6158,6165 ****
*/
len = 0;
while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
! || ((options & FNAME_HYP) && path_is_url(ptr + len)))
{
if (ptr[len] == '\\')
/* Skip over the "\" in "\ ". */
++len;
--- 6159,6177 ----
*/
len = 0;
while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
! || ((options & FNAME_HYP) && path_is_url(ptr + len))
! || (is_url && vim_strchr((char_u *)"?&=", ptr[len]) !=
NULL))
{
+ /* After type:// we also include ?, & and = as valid characters, so that
+ * http://google.com?q=this&that=ok works. */
+ if ((ptr[len] >= 'A' && ptr[len] <= 'Z') || (ptr[len] >= 'a' &&
ptr[len] <= 'z'))
+ {
+ if (in_type && path_is_url(ptr + len + 1))
+ is_url = TRUE;
+ }
+ else
+ in_type = FALSE;
+
if (ptr[len] == '\\')
/* Skip over the "\" in "\ ". */
++len;
*** ../vim-8.0.1425/src/testdir/test_gf.vim 2017-05-24 10:42:29.402752228
+0200
--- src/testdir/test_gf.vim 2017-12-25 14:22:11.297348014 +0100
***************
*** 7,13 ****
\ "first test for URL://machine.name/tmp/vimtest2a and other text",
\ "second test for URL://machine.name/tmp/vimtest2b. And other text",
\ "third test for URL:\\\\machine.name\\vimtest2c and other text",
! \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text"
\ ])
call cursor(1,1)
call search("^first")
--- 7,14 ----
\ "first test for URL://machine.name/tmp/vimtest2a and other text",
\ "second test for URL://machine.name/tmp/vimtest2b. And other text",
\ "third test for URL:\\\\machine.name\\vimtest2c and other text",
! \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other
text",
! \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text",
\ ])
call cursor(1,1)
call search("^first")
***************
*** 28,33 ****
--- 29,38 ----
call search("URL")
call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>"))
+ call search("^fifth")
+ call search("URL")
+ call assert_equal("URL://machine.name/tmp?q=vim&opt=yes", expand("<cfile>"))
+
set isf&vim
enew!
endfunc
*** ../vim-8.0.1425/src/version.c 2017-12-25 13:44:38.340448557 +0100
--- src/version.c 2017-12-25 14:27:04.063886589 +0100
***************
*** 773,774 ****
--- 773,776 ----
{ /* Add new patch number below this line */
+ /**/
+ 1426,
/**/
--
hundred-and-one symptoms of being an internet addict:
161. You get up before the sun rises to check your e-mail, and you
find yourself in the very same chair long after the sun has set.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.