vim-patch:8.1.1100: tag file without trailing newline no longer works

Problem:    Tag file without trailing newline no longer works. (Marco Hinz)
Solution:   Don't expect a newline at the end of the file.

fd700393be
This commit is contained in:
Marco Hinz 2019-04-02 22:15:54 +02:00
parent e05a47f68b
commit a79c0c8f7a
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 18 additions and 3 deletions

View File

@ -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"));

View File

@ -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