patch 9.1.0565: Stop directory doesn't work properly in 'tags'

Commit: 
https://github.com/vim/vim/commit/68819afb2cdd0f44baa080db589e1d8f77099e5f
Author: zeertzjq <zeert...@outlook.com>
Date:   Thu Jul 11 22:19:46 2024 +0200

    patch 9.1.0565: Stop directory doesn't work properly in 'tags'
    
    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 <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/tag.c b/src/tag.c
index 57f9fe016..283343aae 100644
--- 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;
 
diff --git a/src/testdir/test_taglist.vim b/src/testdir/test_taglist.vim
index 2dd236683..136acb3dc 100644
--- a/src/testdir/test_taglist.vim
+++ b/src/testdir/test_taglist.vim
@@ -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([
diff --git a/src/version.c b/src/version.c
index 70254cc43..9c16d1772 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 */
+/**/
+    565,
 /**/
     564,
 /**/

-- 
-- 
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/E1sS0R4-000RPh-Nr%40256bit.org.

Raspunde prin e-mail lui