mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.1.1326: invalid cursor position after 'tagfunc'
Problem: invalid cursor position after 'tagfunc' (gandalf4a) Solution: call check_cursor() after executing the 'tagfunc' Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -1481,6 +1481,7 @@ find_tagfunc_tags(
|
|||||||
save_pos = curwin->w_cursor;
|
save_pos = curwin->w_cursor;
|
||||||
result = call_callback(&curbuf->b_tfu_cb, 0, &rettv, 3, args);
|
result = call_callback(&curbuf->b_tfu_cb, 0, &rettv, 3, args);
|
||||||
curwin->w_cursor = save_pos; // restore the cursor position
|
curwin->w_cursor = save_pos; // restore the cursor position
|
||||||
|
check_cursor(); // make sure cursor position is valid
|
||||||
--d->dv_refcount;
|
--d->dv_refcount;
|
||||||
|
|
||||||
if (result == FAIL)
|
if (result == FAIL)
|
||||||
|
@@ -412,5 +412,24 @@ func Test_tagfunc_closes_window()
|
|||||||
set tagfunc=
|
set tagfunc=
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_tagfunc_deletes_lines()
|
||||||
|
defer delete('Xany')
|
||||||
|
split Xany
|
||||||
|
call writefile([''], 'Xtest', 'D')
|
||||||
|
call setline(1, range(10))
|
||||||
|
call cursor(10, 1)
|
||||||
|
func MytagfuncDel(pat, flags, info)
|
||||||
|
9,10d
|
||||||
|
return [{'name' : 'mytag', 'filename' : 'Xtest', 'cmd' : '1'}]
|
||||||
|
endfunc
|
||||||
|
set tagfunc=MytagfuncDel
|
||||||
|
call taglist('.')
|
||||||
|
call assert_equal([0, 8, 1, 0], getpos('.'))
|
||||||
|
norm! ofoobar
|
||||||
|
call assert_equal(['0', '1', '2', '3', '4', '5', '6', '7', 'foobar'], getline(1, '$'))
|
||||||
|
|
||||||
|
bw!
|
||||||
|
set tagfunc=
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1326,
|
||||||
/**/
|
/**/
|
||||||
1325,
|
1325,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user