diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 51 | ||||
-rw-r--r-- | src/nvim/memory.c | 3 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 7 |
4 files changed, 30 insertions, 33 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8db473d4be..87a5ed80e7 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -9604,7 +9604,7 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv) tabpage_T *tp, *oldtabpage; dictitem_T *v; char_u *varname; - int done = FALSE; + bool done = false; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -9614,14 +9614,14 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv) if (tp != NULL && varname != NULL) { /* Set tp to be our tabpage, temporarily. Also set the window to the * first window in the tabpage, otherwise the window is not valid. */ - switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE); - - /* look up the variable */ - /* Let gettabvar({nr}, "") return the "t:" dictionary. */ - v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE); - if (v != NULL) { - copy_tv(&v->di_tv, rettv); - done = TRUE; + if (switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE) == OK) { + // look up the variable + // Let gettabvar({nr}, "") return the "t:" dictionary. + v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE); + if (v != NULL) { + copy_tv(&v->di_tv, rettv); + done = true; + } } /* restore previous notion of curwin */ @@ -9712,7 +9712,7 @@ getwinvar ( dictitem_T *v; tabpage_T *tp = NULL; tabpage_T *oldtabpage = NULL; - int done = FALSE; + bool done = false; if (off == 1) tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); @@ -9728,18 +9728,18 @@ getwinvar ( if (win != NULL && varname != NULL) { /* Set curwin to be our win, temporarily. Also set the tabpage, * otherwise the window is not valid. */ - switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE); - - if (*varname == '&') { /* window-local-option */ - if (get_option_tv(&varname, rettv, 1) == OK) - done = TRUE; - } else { - /* Look up the variable. */ - /* Let getwinvar({nr}, "") return the "w:" dictionary. */ - v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE); - if (v != NULL) { - copy_tv(&v->di_tv, rettv); - done = TRUE; + if (switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE) == OK) { + if (*varname == '&') { /* window-local-option */ + if (get_option_tv(&varname, rettv, 1) == OK) + done = true; + } else { + // Look up the variable. + // Let getwinvar({nr}, "") return the "w:" dictionary. + v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE); + if (v != NULL) { + copy_tv(&v->di_tv, rettv); + done = true; + } } } @@ -13494,10 +13494,8 @@ static void setwinvar(typval_T *argvars, typval_T *rettv, int off) varname = get_tv_string_chk(&argvars[off + 1]); varp = &argvars[off + 2]; - if (win != NULL && varname != NULL && varp != NULL) { - if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL) - return; - + if (win != NULL && varname != NULL && varp != NULL + && switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == OK) { if (*varname == '&') { long numval; char_u *strval; @@ -13515,7 +13513,6 @@ static void setwinvar(typval_T *argvars, typval_T *rettv, int off) set_var(winvarname, varp, TRUE); free(winvarname); } - restore_win(save_curwin, save_curtab, TRUE); } } diff --git a/src/nvim/memory.c b/src/nvim/memory.c index a2274a25fe..c954ab3c7b 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -489,7 +489,8 @@ void free_all_mem(void) return; entered = true; - block_autocmds(); /* don't want to trigger autocommands here */ + // Don't want to trigger autocommands from here on. + block_autocmds(); /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ p_ea = FALSE; diff --git a/src/nvim/version.c b/src/nvim/version.c index 5e3331317d..bb988a1012 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -299,7 +299,7 @@ static int included_patches[] = { 449, //448 NA 447, - //446, + 446, //445, 444, //443 NA diff --git a/src/nvim/window.c b/src/nvim/window.c index cf0977e280..52a1853f4b 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1024,7 +1024,7 @@ static void win_init(win_T *newp, win_T *oldp, int flags) } /* - * Initialize window "newp" from window"old". + * Initialize window "newp" from window "old". * Only the essential things are copied. */ static void win_init_some(win_T *newp, win_T *oldp) @@ -5190,8 +5190,8 @@ static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr) /* * Set "win" to be the curwin and "tp" to be the current tab page. - * restore_win() MUST be called to undo. - * No autocommands will be executed. + * restore_win() MUST be called to undo, also when FAIL is returned. + * No autocommands will be executed until restore_win() is called. * When "no_display" is TRUE the display won't be affected, no redraw is * triggered, another tabpage access is limited. * Returns FAIL if switching to "win" failed. @@ -5212,7 +5212,6 @@ int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage goto_tabpage_tp(tp, FALSE, FALSE); } if (!win_valid(win)) { - unblock_autocmds(); return FAIL; } curwin = win; |