mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
Merge pull request #32880 from zeertzjq/backport
Backport #32739 to release-0.10
This commit is contained in:
@ -3014,6 +3014,8 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, bool keep_help)
|
||||
secure = 1;
|
||||
sandbox++;
|
||||
curwin->w_cursor.lnum = 1; // start command in line 1
|
||||
curwin->w_cursor.col = 0;
|
||||
curwin->w_cursor.coladd = 0;
|
||||
do_cmdline_cmd(pbuf);
|
||||
retval = OK;
|
||||
|
||||
|
@ -1623,4 +1623,39 @@ func Test_tagbsearch()
|
||||
set tags& tagbsearch&
|
||||
endfunc
|
||||
|
||||
" Test tag guessing with very short names
|
||||
func Test_tag_guess_short()
|
||||
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||
\ "y\tXf\t/^y()/"],
|
||||
\ 'Xt', 'D')
|
||||
set tags=Xt cpoptions+=t
|
||||
call writefile(['', 'int * y () {}', ''], 'Xf', 'D')
|
||||
|
||||
let v:statusmsg = ''
|
||||
let @/ = ''
|
||||
ta y
|
||||
call assert_match('E435:', v:statusmsg)
|
||||
call assert_equal(2, line('.'))
|
||||
call assert_match('<y', @/)
|
||||
|
||||
set tags& cpoptions-=t
|
||||
endfunc
|
||||
|
||||
func Test_tag_excmd_with_nostartofline()
|
||||
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||
\ "f\tXfile\tascii"],
|
||||
\ 'Xtags', 'D')
|
||||
call writefile(['f', 'foobar'], 'Xfile', 'D')
|
||||
|
||||
set nostartofline
|
||||
new Xfile
|
||||
setlocal tags=Xtags
|
||||
normal! G$
|
||||
" This used to cause heap-buffer-overflow
|
||||
tag f
|
||||
|
||||
bwipe!
|
||||
set startofline&
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Reference in New Issue
Block a user