mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch:8.0.0550
Problem: Some etags format tags file use 0x01, breaking the parsing.
Solution: Use 0x02 for TAG_SEP. (James McCoy, closes vim/vim#1614)
9585a1655b
This commit is contained in:
@@ -1847,14 +1847,14 @@ parse_line:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#define TAG_SEP 0x01
|
#define TAG_SEP 0x02
|
||||||
size_t tag_fname_len = STRLEN(tag_fname);
|
size_t tag_fname_len = STRLEN(tag_fname);
|
||||||
// Save the tag in a buffer.
|
// Save the tag in a buffer.
|
||||||
// Use 0x01 to separate fields (Can't use NUL, because the
|
// Use 0x02 to separate fields (Can't use NUL, because the
|
||||||
// hash key is terminated by NUL).
|
// hash key is terminated by NUL).
|
||||||
// Emacs tag: <mtt><tag_fname><NUL><ebuf><NUL><lbuf>
|
// Emacs tag: <mtt><tag_fname><0x02><ebuf><0x02><lbuf><NUL>
|
||||||
// other tag: <mtt><tag_fname><NUL><NUL><lbuf>
|
// other tag: <mtt><tag_fname><0x02><0x02><lbuf><NUL>
|
||||||
// without Emacs tags: <mtt><tag_fname><NUL><lbuf>
|
// without Emacs tags: <mtt><tag_fname><0x02><lbuf><NUL>
|
||||||
// Here <mtt> is the "mtt" value plus 1 to avoid NUL.
|
// Here <mtt> is the "mtt" value plus 1 to avoid NUL.
|
||||||
len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3;
|
len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3;
|
||||||
mfp = xmalloc(sizeof(char_u) + len + 1);
|
mfp = xmalloc(sizeof(char_u) + len + 1);
|
||||||
|
@@ -19,3 +19,40 @@ func Test_taglist()
|
|||||||
bwipe
|
bwipe
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_taglist_native_etags()
|
||||||
|
if !has('emacs_tags')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call writefile([
|
||||||
|
\ "\x0c",
|
||||||
|
\ "src/os_unix.c,13491",
|
||||||
|
\ "set_signals(\x7f1335,32699",
|
||||||
|
\ "reset_signals(\x7f1407,34136",
|
||||||
|
\ ], 'Xtags')
|
||||||
|
|
||||||
|
set tags=Xtags
|
||||||
|
|
||||||
|
call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
|
||||||
|
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
|
||||||
|
|
||||||
|
call delete('Xtags')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_taglist_ctags_etags()
|
||||||
|
if !has('emacs_tags')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call writefile([
|
||||||
|
\ "\x0c",
|
||||||
|
\ "src/os_unix.c,13491",
|
||||||
|
\ "set_signals(void)\x7fset_signals\x011335,32699",
|
||||||
|
\ "reset_signals(void)\x7freset_signals\x011407,34136",
|
||||||
|
\ ], 'Xtags')
|
||||||
|
|
||||||
|
set tags=Xtags
|
||||||
|
|
||||||
|
call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
|
||||||
|
\ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
|
||||||
|
|
||||||
|
call delete('Xtags')
|
||||||
|
endfunc
|
||||||
|
Reference in New Issue
Block a user