mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.3625: illegal memory access when C-indenting
Problem: Illegal memory access when C-indenting.
Solution: Also set the cursor column.
2de9b7c7c8
This commit is contained in:
parent
6714ea35ac
commit
de8a2f20e9
@ -1412,8 +1412,8 @@ static int cin_skip2pos(pos_T *trypos)
|
|||||||
static pos_T *find_start_brace(void) // XXX
|
static pos_T *find_start_brace(void) // XXX
|
||||||
{
|
{
|
||||||
pos_T cursor_save;
|
pos_T cursor_save;
|
||||||
pos_T *trypos;
|
pos_T *trypos;
|
||||||
pos_T *pos;
|
pos_T *pos;
|
||||||
static pos_T pos_copy;
|
static pos_T pos_copy;
|
||||||
|
|
||||||
cursor_save = curwin->w_cursor;
|
cursor_save = curwin->w_cursor;
|
||||||
@ -1428,7 +1428,7 @@ static pos_T *find_start_brace(void) // XXX
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pos != NULL) {
|
if (pos != NULL) {
|
||||||
curwin->w_cursor.lnum = pos->lnum;
|
curwin->w_cursor = *pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
curwin->w_cursor = cursor_save;
|
curwin->w_cursor = cursor_save;
|
||||||
|
@ -5303,4 +5303,16 @@ func Test_backslash_at_end_of_line()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user