Merge pull request #1704 from fwalch/vim-7.4.434

vim-patch:7.4.434, vim-patch:7.4.442
This commit is contained in:
Justin M. Keyes 2014-12-19 01:35:42 -05:00
commit 5df8bf077b
5 changed files with 20 additions and 7 deletions

View File

@ -3578,6 +3578,8 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
Get the value of a tab-local variable {varname} in tab page Get the value of a tab-local variable {varname} in tab page
{tabnr}. |t:var| {tabnr}. |t:var|
Tabs are numbered starting with one. Tabs are numbered starting with one.
When {varname} is empty a dictionary with all tab-local
variables is returned.
Note that the name without "t:" must be used. Note that the name without "t:" must be used.
When the tab or variable doesn't exist {def} or an empty When the tab or variable doesn't exist {def} or an empty
string is returned, there is no error message. string is returned, there is no error message.

View File

@ -9603,7 +9603,8 @@ static void f_getregtype(typval_T *argvars, typval_T *rettv)
*/ */
static void f_gettabvar(typval_T *argvars, typval_T *rettv) static void f_gettabvar(typval_T *argvars, typval_T *rettv)
{ {
tabpage_T *tp; win_T *oldcurwin;
tabpage_T *tp, *oldtabpage;
dictitem_T *v; dictitem_T *v;
char_u *varname; char_u *varname;
int done = FALSE; int done = FALSE;
@ -9614,16 +9615,25 @@ 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
* first window in the tabpage, otherwise the window is not valid. */
switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE);
/* look up the variable */ /* look up the variable */
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE); /* Let gettabvar({nr}, "") return the "t:" dictionary. */
v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE);
if (v != NULL) { if (v != NULL) {
copy_tv(&v->di_tv, rettv); copy_tv(&v->di_tv, rettv);
done = TRUE; done = TRUE;
} }
/* restore previous notion of curwin */
restore_win(oldcurwin, oldtabpage, TRUE);
} }
if (!done && argvars[2].v_type != VAR_UNKNOWN) if (!done && argvars[2].v_type != VAR_UNKNOWN) {
copy_tv(&argvars[2], rettv); copy_tv(&argvars[2], rettv);
}
} }
/* /*

View File

@ -55,6 +55,7 @@ STARTTEST
:tabnew :tabnew
:tabnew :tabnew
:let t:var_list = [1, 2, 3] :let t:var_list = [1, 2, 3]
:let t:other = 777
:let def_list = [4, 5, 6, 7] :let def_list = [4, 5, 6, 7]
:tabrewind :tabrewind
:$put =string(gettabvar(3, 'var_list')) :$put =string(gettabvar(3, 'var_list'))

View File

@ -26,8 +26,8 @@ iso-8859-2
0 0
[1, 2, 3] [1, 2, 3]
[1, 2, 3] [1, 2, 3]
'' {'var_list': [1, 2, 3], 'other': 777}
[4, 5, 6, 7] {'var_list': [1, 2, 3], 'other': 777}
[4, 5, 6, 7] [4, 5, 6, 7]
'' ''
[4, 5, 6, 7] [4, 5, 6, 7]

View File

@ -287,7 +287,7 @@ static int included_patches[] = {
//445, //445,
444, 444,
//443, //443,
//442, 442,
//441, //441,
440, 440,
439, 439,
@ -295,7 +295,7 @@ static int included_patches[] = {
437, 437,
436, 436,
435, 435,
//434, 434,
433, 433,
//432 NA //432 NA
//431 NA //431 NA