patch 9.1.0428: Tag guessing leaves wrong search history with very short names

Commit: 
https://github.com/vim/vim/commit/42cd192daa4b7f29131c7be1beaecb6067e96266
Author: zeertzjq <zeert...@outlook.com>
Date:   Tue May 21 17:19:58 2024 +0200

    patch 9.1.0428: Tag guessing leaves wrong search history with very short 
names
    
    Problem:  Tag guessing leaves wrong search history with very short names
              (after 9.1.0426).
    Solution: Use the correct variable for pattern length (zeertzjq).
    
    closes: #14817
    
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/tag.c b/src/tag.c
index 87ff802c7..d406fdec1 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -3945,7 +3945,7 @@ jumpto_tag(
                        // Guess again: "^char * \<func  ("
                        pbuflen = vim_snprintf((char *)pbuf, LSIZE, 
"^\[#a-zA-Z_]\.\*\<%s\s\*(",
                                                                tagp.tagname);
-                       if (!do_search(NULL, '/', '/', pbuf, len, (long)1,
+                       if (!do_search(NULL, '/', '/', pbuf, pbuflen, (long)1,
                                                         search_options, NULL))
                            found = 0;
                    }
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 2abf1f659..432906efb 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -1560,4 +1560,22 @@ func Test_tagbsearch()
   set tags& tagbsearch&
 endfunc
 
+" Test tag guessing with very short names
+func Test_tag_guess_short()
+  call writefile(["!_TAG_FILE_ENCODING utf-8   //",
+        \ "y   Xf      /^y()/"],
+        \ 'Xt', 'D')
+  set tags=Xt cpoptions+=t
+  call writefile(['', 'int * y () {}', ''], 'Xf', 'D')
+
+  let v:statusmsg = ''
+  let @/ = ''
+  ta y
+  call assert_match('E435:', v:statusmsg)
+  call assert_equal(2, line('.'))
+  call assert_match('<y', @/)
+
+  set tags& cpoptions-=t
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 7d3a7e570..acec967b8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    428,
 /**/
     427,
 /**/

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1s9RRN-00FjoV-AZ%40256bit.org.

Raspunde prin e-mail lui