mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
dcdb50b64b
@ -10593,9 +10593,10 @@ static void f_gettabvar(typval_T *argvars, typval_T *rettv)
|
|||||||
varname = get_tv_string_chk(&argvars[1]);
|
varname = get_tv_string_chk(&argvars[1]);
|
||||||
tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
|
tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
|
||||||
if (tp != NULL && varname != NULL) {
|
if (tp != NULL && varname != NULL) {
|
||||||
/* Set tp to be our tabpage, temporarily. Also set the window to the
|
// Set tp to be our tabpage, temporarily. Also set the window to the
|
||||||
* first window in the tabpage, otherwise the window is not valid. */
|
// first window in the tabpage, otherwise the window is not valid.
|
||||||
if (switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE) == OK) {
|
win_T *window = tp->tp_firstwin == NULL ? firstwin : tp->tp_firstwin;
|
||||||
|
if (switch_win(&oldcurwin, &oldtabpage, window, tp, true) == OK) {
|
||||||
// look up the variable
|
// look up the variable
|
||||||
// Let gettabvar({nr}, "") return the "t:" dictionary.
|
// Let gettabvar({nr}, "") return the "t:" dictionary.
|
||||||
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
|
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
|
||||||
|
@ -454,7 +454,7 @@ static int included_patches[] = {
|
|||||||
// 837 NA
|
// 837 NA
|
||||||
836,
|
836,
|
||||||
// 835,
|
// 835,
|
||||||
// 834,
|
834,
|
||||||
// 833,
|
// 833,
|
||||||
// 832,
|
// 832,
|
||||||
// 831,
|
// 831,
|
||||||
|
@ -13,6 +13,9 @@ describe('context variables', function()
|
|||||||
-- Test for getbufvar().
|
-- Test for getbufvar().
|
||||||
-- Use strings to test for memory leaks.
|
-- Use strings to test for memory leaks.
|
||||||
source([[
|
source([[
|
||||||
|
let t:testvar='abcd'
|
||||||
|
$put =string(gettabvar(1, 'testvar'))
|
||||||
|
$put =string(gettabvar(1, 'testvar'))
|
||||||
let b:var_num = '1234'
|
let b:var_num = '1234'
|
||||||
let def_num = '5678'
|
let def_num = '5678'
|
||||||
$put =string(getbufvar(1, 'var_num'))
|
$put =string(getbufvar(1, 'var_num'))
|
||||||
@ -125,6 +128,8 @@ describe('context variables', function()
|
|||||||
-- Assert buffer contents.
|
-- Assert buffer contents.
|
||||||
expect([[
|
expect([[
|
||||||
start:
|
start:
|
||||||
|
'abcd'
|
||||||
|
'abcd'
|
||||||
'1234'
|
'1234'
|
||||||
'1234'
|
'1234'
|
||||||
{'var_num': '1234'}
|
{'var_num': '1234'}
|
||||||
|
Loading…
Reference in New Issue
Block a user