diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 35 | ||||
-rw-r--r-- | src/nvim/indent_c.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test3.in | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test3.ok | 8 | ||||
-rw-r--r-- | src/nvim/version.c | 4 |
5 files changed, 48 insertions, 12 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d058e6ccae..f50a215559 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -15247,16 +15247,31 @@ static void f_winrestview(typval_T *argvars, typval_T *rettv) || (dict = argvars[0].vval.v_dict) == NULL) EMSG(_(e_invarg)); else { - curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum"); - curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col"); - curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd"); - curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); - curwin->w_set_curswant = FALSE; - - set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); - curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); - curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol"); - curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol"); + if (dict_find(dict, (char_u *)"lnum", -1) != NULL) { + curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum"); + } + if (dict_find(dict, (char_u *)"col", -1) != NULL) { + curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col"); + } + if (dict_find(dict, (char_u *)"coladd", -1) != NULL) { + curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd"); + } + if (dict_find(dict, (char_u *)"curswant", -1) != NULL) { + curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); + curwin->w_set_curswant = FALSE; + } + if (dict_find(dict, (char_u *)"topline", -1) != NULL) { + set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); + } + if (dict_find(dict, (char_u *)"topfill", -1) != NULL) { + curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); + } + if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) { + curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol"); + } + if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) { + curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol"); + } check_cursor(); win_new_height(curwin, curwin->w_height); diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index bbc0b291dc..39ad512227 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1545,6 +1545,7 @@ int get_c_indent(void) char_u *linecopy; pos_T *trypos; pos_T *tryposBrace = NULL; + pos_T tryposBraceCopy; pos_T our_paren_pos; char_u *start; int start_brace; @@ -2026,6 +2027,10 @@ int get_c_indent(void) } else { // We are inside braces, there is a { before this line at the position // stored in tryposBrace. + // Make a copy of tryposBrace, it may point to pos_copy inside + // find_start_brace(), which may be changed somewhere. + tryposBraceCopy = *tryposBrace; + tryposBrace = &tryposBraceCopy; trypos = tryposBrace; ourscope = trypos->lnum; start = ml_get(ourscope); diff --git a/src/nvim/testdir/test3.in b/src/nvim/testdir/test3.in index 7f6d412806..42255e2019 100644 --- a/src/nvim/testdir/test3.in +++ b/src/nvim/testdir/test3.in @@ -464,6 +464,14 @@ label: if (asdf && asdfasdf } +{ +for ( int i = 0; + i < 10; i++ ) +{ +} + i = 0; +} + class bob { int foo() {return 1;} diff --git a/src/nvim/testdir/test3.ok b/src/nvim/testdir/test3.ok index 0d0e76fce4..e75de0ffa3 100644 --- a/src/nvim/testdir/test3.ok +++ b/src/nvim/testdir/test3.ok @@ -452,6 +452,14 @@ label: if (asdf && asdfasdf } +{ + for ( int i = 0; + i < 10; i++ ) + { + } + i = 0; +} + class bob { int foo() {return 1;} diff --git a/src/nvim/version.c b/src/nvim/version.c index eb07eb6d12..f3897212fa 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -342,7 +342,7 @@ static int included_patches[] = { //398 NA 397, //396, - //395, + 395, //394 NA //393 NA 392, @@ -426,7 +426,7 @@ static int included_patches[] = { 314, 313, 312, - //311, + 311, 310, 309, 308, |