mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
vim-patch:8.1.1094: long line in tags file causes error
Problem: Long line in tags file causes error.
Solution: Check for overlong line earlier. (Andy Massimino)
5209334c55
This commit is contained in:
@@ -1527,36 +1527,32 @@ line_read_in:
|
|||||||
}
|
}
|
||||||
|
|
||||||
parse_line:
|
parse_line:
|
||||||
/*
|
if (vim_strchr(lbuf, NL) == NULL && !use_cscope) {
|
||||||
* Figure out where the different strings are in this line.
|
// Truncated line, ignore it. Has been reported for Mozilla JS with
|
||||||
* For "normal" tags: Do a quick check if the tag matches.
|
// extremely long names.
|
||||||
* This speeds up tag searching a lot!
|
|
||||||
*/
|
|
||||||
if (orgpat.headlen
|
|
||||||
) {
|
|
||||||
tagp.tagname = lbuf;
|
|
||||||
tagp.tagname_end = vim_strchr(lbuf, TAB);
|
|
||||||
if (tagp.tagname_end == NULL)
|
|
||||||
{
|
|
||||||
if (vim_strchr(lbuf, NL) == NULL) {
|
|
||||||
/* Truncated line, ignore it. Has been reported for
|
|
||||||
* Mozilla JS with extremely long names. */
|
|
||||||
if (p_verbose >= 5) {
|
if (p_verbose >= 5) {
|
||||||
verbose_enter();
|
verbose_enter();
|
||||||
MSG(_("Ignoring long line in tags file"));
|
MSG(_("Ignoring long line in tags file"));
|
||||||
verbose_leave();
|
verbose_leave();
|
||||||
}
|
}
|
||||||
if (state != TS_LINEAR) {
|
if (state != TS_LINEAR) {
|
||||||
/* Avoid getting stuck. */
|
// Avoid getting stuck.
|
||||||
linear = TRUE;
|
linear = true;
|
||||||
state = TS_LINEAR;
|
state = TS_LINEAR;
|
||||||
vim_fseek(fp, search_info.low_offset, SEEK_SET);
|
vim_fseek(fp, search_info.low_offset, SEEK_SET);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Corrupted tag line. */
|
// Figure out where the different strings are in this line.
|
||||||
line_error = TRUE;
|
// For "normal" tags: Do a quick check if the tag matches.
|
||||||
|
// This speeds up tag searching a lot!
|
||||||
|
if (orgpat.headlen) {
|
||||||
|
tagp.tagname = lbuf;
|
||||||
|
tagp.tagname_end = vim_strchr(lbuf, TAB);
|
||||||
|
if (tagp.tagname_end == NULL) {
|
||||||
|
// Corrupted tag line.
|
||||||
|
line_error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -331,4 +331,35 @@ func Test_tagnr_recall()
|
|||||||
call delete('Xtest.c')
|
call delete('Xtest.c')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_tag_line_toolong()
|
||||||
|
call writefile([
|
||||||
|
\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
|
||||||
|
\ ], 'Xtags')
|
||||||
|
set tags=Xtags
|
||||||
|
let old_vbs = &verbose
|
||||||
|
set verbose=5
|
||||||
|
" ":tjump" should give "tag not found" not "Format error in tags file"
|
||||||
|
call assert_fails('tj /foo', 'E426')
|
||||||
|
try
|
||||||
|
tj /foo
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E431/
|
||||||
|
call assert_report(v:exception)
|
||||||
|
catch /.*/
|
||||||
|
endtry
|
||||||
|
call assert_equal('Ignoring long line in tags file', split(execute('messages'), '\n')[-1])
|
||||||
|
call writefile([
|
||||||
|
\ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
|
||||||
|
\ ], 'Xtags')
|
||||||
|
call assert_fails('tj /foo', 'E426')
|
||||||
|
try
|
||||||
|
tj /foo
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E431/
|
||||||
|
call assert_report(v:exception)
|
||||||
|
catch /.*/
|
||||||
|
endtry
|
||||||
|
call assert_equal('Ignoring long line in tags file', split(execute('messages'), '\n')[-1])
|
||||||
|
call delete('Xtags')
|
||||||
|
let &verbose = old_vbs
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Reference in New Issue
Block a user