aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-12 05:45:40 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-12 06:49:35 +0800
commit50feb85b0c1e29583c6f6f928512e7b853a3ebf6 (patch)
tree4922241565c07b43ce06c48f532c896e3b47b36d
parent2c9e82e193463180fe9af6435f491f24ed69ab90 (diff)
downloadrneovim-50feb85b0c1e29583c6f6f928512e7b853a3ebf6.tar.gz
rneovim-50feb85b0c1e29583c6f6f928512e7b853a3ebf6.tar.bz2
rneovim-50feb85b0c1e29583c6f6f928512e7b853a3ebf6.zip
vim-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: vim/vim#15200 related: vim/vim#15202 https://github.com/vim/vim/commit/68819afb2cdd0f44baa080db589e1d8f77099e5f
-rw-r--r--src/nvim/tag.c4
-rw-r--r--test/old/testdir/test_taglist.vim23
2 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 90269c776e..cc7ff070c2 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -2583,6 +2583,10 @@ int get_tagfname(tagname_T *tnp, int first, char *buf)
// move the filename one char forward and truncate the
// filepath with a NUL
filename = path_tail(buf);
+ if (r_ptr != NULL) {
+ STRMOVE(r_ptr + 1, r_ptr);
+ r_ptr++;
+ }
STRMOVE(filename + 1, filename);
*filename++ = NUL;
diff --git a/test/old/testdir/test_taglist.vim b/test/old/testdir/test_taglist.vim
index 75d28c3ec4..d74bd1e0e1 100644
--- a/test/old/testdir/test_taglist.vim
+++ b/test/old/testdir/test_taglist.vim
@@ -135,6 +135,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([