0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.3625: illegal memory access when C-indenting

Problem:    Illegal memory access when C-indenting.
Solution:   Also set the cursor column.
This commit is contained in:
Bram Moolenaar
2021-11-19 19:41:13 +00:00
parent 3ad695328f
commit 2de9b7c7c8
3 changed files with 19 additions and 5 deletions

View File

@@ -1654,7 +1654,7 @@ find_start_brace(void) // XXX
&& (pos = ind_find_start_CORS(NULL)) == NULL) // XXX
break;
if (pos != NULL)
curwin->w_cursor.lnum = pos->lnum;
curwin->w_cursor = *pos;
}
curwin->w_cursor = cursor_save;
return trypos;

View File

@@ -5314,4 +5314,16 @@ func Test_backslash_at_end_of_line()
bwipe!
endfunc
func Test_find_brace_backwards()
" this was looking beyond the end of the line
new
norm R/*
norm o0{
norm o//
norm V{=
call assert_equal(['/*', ' 0{', '//'], getline(1, 3))
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3625,
/**/
3624,
/**/