Patch 8.2.1684
Problem:    "gF" does not use line number after file in Visual mode.
Solution:   Look for ":123" after the Visual area. (closes #6952)
Files:      src/findfile.c, src/testdir/test_gf.vim


*** ../vim-8.2.1683/src/findfile.c      2020-06-24 20:33:59.565106319 +0200
--- src/findfile.c      2020-09-14 19:00:42.911946172 +0200
***************
*** 1934,1939 ****
--- 1934,1946 ----
  
        if (get_visual_text(NULL, &ptr, &len) == FAIL)
            return NULL;
+       // Only recognize ":123" here
+       if (file_lnum != NULL && ptr[len] == ':' && isdigit(ptr[len + 1]))
+       {
+           char_u *p = ptr + len + 1;
+ 
+           *file_lnum = getdigits(&p);
+       }
        return find_file_name_in_path(ptr, len, options,
                                                     count, curbuf->b_ffname);
      }
*** ../vim-8.2.1683/src/testdir/test_gf.vim     2020-06-26 20:41:35.628844696 
+0200
--- src/testdir/test_gf.vim     2020-09-14 19:09:19.742764944 +0200
***************
*** 124,130 ****
  endfunc
  
  func Test_gf_visual()
!   call writefile([], "Xtest_gf_visual")
    new
    call setline(1, 'XXXtest_gf_visualXXX')
    set hidden
--- 124,130 ----
  endfunc
  
  func Test_gf_visual()
!   call writefile(['one', 'two', 'three', 'four'], "Xtest_gf_visual")
    new
    call setline(1, 'XXXtest_gf_visualXXX')
    set hidden
***************
*** 138,143 ****
--- 138,162 ----
    normal VGgf
    call assert_equal('Xtest_gf_visual', @%)
  
+   " following line number is used for gF
+   bwipe!
+   new
+   call setline(1, 'XXXtest_gf_visual:3XXX')
+   norm! 0ttvt:gF
+   call assert_equal('Xtest_gf_visual', bufname('%'))
+   call assert_equal(3, getcurpos()[1])
+ 
+   " line number in visual area is used for file name
+   if has('unix')
+     bwipe!
+     call writefile([], "Xtest_gf_visual:3")
+     new
+     call setline(1, 'XXXtest_gf_visual:3XXX')
+     norm! 0ttvtXgF
+     call assert_equal('Xtest_gf_visual:3', bufname('%'))
+   call delete('Xtest_gf_visual:3')
+   endif
+ 
    bwipe!
    call delete('Xtest_gf_visual')
    set hidden&
*** ../vim-8.2.1683/src/version.c       2020-09-14 18:35:14.984866572 +0200
--- src/version.c       2020-09-14 19:01:49.435821391 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1684,
  /**/

-- 
Behold the warranty!  The bold print giveth and the fine print taketh.

 /// 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202009141712.08EHCW2G1684363%40masaka.moolenaar.net.

Raspunde prin e-mail lui