Skip to content

Commit

Permalink
patch 9.1.0565: Stop directory doesn't work properly in 'tags'
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
zeertzjq authored and chrisbra committed Jul 11, 2024
1 parent 0512425 commit 68819af
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
23 changes: 23 additions & 0 deletions src/testdir/test_taglist.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
565,
/**/
564,
/**/
Expand Down

0 comments on commit 68819af

Please sign in to comment.