]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0565: Stop directory doesn't work properly in 'tags' v9.1.0565
authorzeertzjq <zeertzjq@outlook.com>
Thu, 11 Jul 2024 20:19:46 +0000 (22:19 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 11 Jul 2024 20:25:42 +0000 (22:25 +0200)
Problem:  Stop directory doesn't work properly in 'tags'.
          (Jesse Pavel)
Solution: Also move the stop directory forward by one byte.
          (zeertzjq)

This doesn't support relative stop directories yet, as they are not
supported in other places like findfile() either.

fixes: #15200
related: #15202

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/tag.c
src/testdir/test_taglist.vim
src/version.c

index 57f9fe016ab0ced723c6d614fbbcf030416858fa..283343aae21ef156d762390450864d6c4efb8b49 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -3412,6 +3412,11 @@ get_tagfname(
            // move the filename one char forward and truncate the
            // filepath with a NUL
            filename = gettail(buf);
+           if (r_ptr != NULL)
+           {
+               STRMOVE(r_ptr + 1, r_ptr);
+               ++r_ptr;
+           }
            STRMOVE(filename + 1, filename);
            *filename++ = NUL;
 
index 2dd236683b20f88c100533af124d07d3cd42984c..136acb3dcdea8d054828e41c8026e5d54df8e49d 100644 (file)
@@ -127,6 +127,29 @@ func Test_tagsfile_without_trailing_newline()
   set tags&
 endfunc
 
+" Check that specifying a stop directory in 'tags' works properly.
+func Test_tagfiles_stopdir()
+  let save_cwd = getcwd()
+
+  call mkdir('Xtagsdir1/Xtagsdir2/Xtagsdir3', 'pR')
+  call writefile([], 'Xtagsdir1/Xtags', 'D')
+
+  cd Xtagsdir1/
+  let &tags = './Xtags;' .. fnamemodify('./..', ':p')
+  call assert_equal(1, len(tagfiles()))
+
+  cd Xtagsdir2/
+  let &tags = './Xtags;' .. fnamemodify('./..', ':p')
+  call assert_equal(1, len(tagfiles()))
+
+  cd Xtagsdir3/
+  let &tags = './Xtags;' .. fnamemodify('./..', ':p')
+  call assert_equal(0, len(tagfiles()))
+
+  set tags&
+  call chdir(save_cwd)
+endfunc
+
 " Test for ignoring comments in a tags file
 func Test_tagfile_ignore_comments()
   call writefile([
index 70254cc431de4acbd4df3c6123b8c3c0e3ee1b78..9c16d1772d4155a785b617e1c89059831f9a43ac 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    565,
 /**/
     564,
 /**/