diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/tag.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_taglist.vim | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c index c2254e2416..861063ff62 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1527,9 +1527,11 @@ line_read_in: } parse_line: - if (vim_strchr(lbuf, NL) == NULL && !use_cscope) { - // Truncated line, ignore it. Has been reported for Mozilla JS with - // extremely long names. + // When the line is too long the NUL will not be in the + // last-but-one byte (see vim_fgets()). + // Has been reported for Mozilla JS with extremely long names. + // In that case we can't parse it and we ignore the line. + if (lbuf[LSIZE - 2] != NUL && !use_cscope) { if (p_verbose >= 5) { verbose_enter(); MSG(_("Ignoring long line in tags file")); diff --git a/src/nvim/testdir/test_taglist.vim b/src/nvim/testdir/test_taglist.vim index 3ad2025915..f4e939254a 100644 --- a/src/nvim/testdir/test_taglist.vim +++ b/src/nvim/testdir/test_taglist.vim @@ -61,3 +61,16 @@ func Test_tags_too_long() call assert_fails('tag ' . repeat('x', 1020), 'E426') tags endfunc + +" For historical reasons we support a tags file where the last line is missing +" the newline. +func Test_tagsfile_without_trailing_newline() + call writefile(["Foo\tfoo\t1"], 'Xtags', 'b') + set tags=Xtags + + let tl = taglist('.*') + call assert_equal(1, len(tl)) + call assert_equal('Foo', tl[0].name) + + call delete('Xtags') +endfunc |