forked from aniani/vim
patch 8.1.1832: win_execute() does not work in other tab
Problem: Win_execute() does not work in other tab. (Rick Howe) Solution: Take care of the tab. (closes #4792)
This commit is contained in:
@@ -5726,14 +5726,14 @@ f_getwininfo(typval_T *argvars, typval_T *rettv)
|
|||||||
f_win_execute(typval_T *argvars, typval_T *rettv)
|
f_win_execute(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
int id = (int)tv_get_number(argvars);
|
int id = (int)tv_get_number(argvars);
|
||||||
win_T *wp = win_id2wp(id);
|
tabpage_T *tp;
|
||||||
|
win_T *wp = win_id2wp_tp(id, &tp);
|
||||||
win_T *save_curwin;
|
win_T *save_curwin;
|
||||||
tabpage_T *save_curtab;
|
tabpage_T *save_curtab;
|
||||||
|
|
||||||
if (wp != NULL)
|
if (wp != NULL && tp != NULL)
|
||||||
{
|
{
|
||||||
if (switch_win_noblock(&save_curwin, &save_curtab, wp, curtab, TRUE)
|
if (switch_win_noblock(&save_curwin, &save_curtab, wp, tp, TRUE) == OK)
|
||||||
== OK)
|
|
||||||
{
|
{
|
||||||
check_cursor();
|
check_cursor();
|
||||||
execute_common(argvars, rettv, 1);
|
execute_common(argvars, rettv, 1);
|
||||||
|
@@ -90,6 +90,7 @@ int win_getid(typval_T *argvars);
|
|||||||
int win_gotoid(typval_T *argvars);
|
int win_gotoid(typval_T *argvars);
|
||||||
void win_id2tabwin(typval_T *argvars, list_T *list);
|
void win_id2tabwin(typval_T *argvars, list_T *list);
|
||||||
win_T *win_id2wp(int id);
|
win_T *win_id2wp(int id);
|
||||||
|
win_T *win_id2wp_tp(int id, tabpage_T **tpp);
|
||||||
int win_id2win(typval_T *argvars);
|
int win_id2win(typval_T *argvars);
|
||||||
void win_findbuf(typval_T *argvars, list_T *list);
|
void win_findbuf(typval_T *argvars, list_T *list);
|
||||||
void get_framelayout(frame_T *fr, list_T *l, int outer);
|
void get_framelayout(frame_T *fr, list_T *l, int outer);
|
||||||
|
@@ -100,3 +100,12 @@ func Test_win_execute()
|
|||||||
call win_gotoid(otherwin)
|
call win_gotoid(otherwin)
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_win_execute_other_tab()
|
||||||
|
let thiswin = win_getid()
|
||||||
|
tabnew
|
||||||
|
call win_execute(thiswin, 'let xyz = 1')
|
||||||
|
call assert_equal(1, xyz)
|
||||||
|
tabclose
|
||||||
|
unlet xyz
|
||||||
|
endfunc
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1832,
|
||||||
/**/
|
/**/
|
||||||
1831,
|
1831,
|
||||||
/**/
|
/**/
|
||||||
|
24
src/window.c
24
src/window.c
@@ -6887,24 +6887,48 @@ win_id2tabwin(typval_T *argvars, list_T *list)
|
|||||||
list_append_number(list, 0);
|
list_append_number(list, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the window pointer of window "id".
|
||||||
|
*/
|
||||||
win_T *
|
win_T *
|
||||||
win_id2wp(int id)
|
win_id2wp(int id)
|
||||||
|
{
|
||||||
|
return win_id2wp_tp(id, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the window and tab pointer of window "id".
|
||||||
|
*/
|
||||||
|
win_T *
|
||||||
|
win_id2wp_tp(int id, tabpage_T **tpp)
|
||||||
{
|
{
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
|
|
||||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||||
if (wp->w_id == id)
|
if (wp->w_id == id)
|
||||||
|
{
|
||||||
|
if (tpp != NULL)
|
||||||
|
*tpp = tp;
|
||||||
return wp;
|
return wp;
|
||||||
|
}
|
||||||
#ifdef FEAT_TEXT_PROP
|
#ifdef FEAT_TEXT_PROP
|
||||||
// popup windows are in separate lists
|
// popup windows are in separate lists
|
||||||
FOR_ALL_TABPAGES(tp)
|
FOR_ALL_TABPAGES(tp)
|
||||||
for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)
|
for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
if (wp->w_id == id)
|
if (wp->w_id == id)
|
||||||
|
{
|
||||||
|
if (tpp != NULL)
|
||||||
|
*tpp = tp;
|
||||||
return wp;
|
return wp;
|
||||||
|
}
|
||||||
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
if (wp->w_id == id)
|
if (wp->w_id == id)
|
||||||
|
{
|
||||||
|
if (tpp != NULL)
|
||||||
|
*tpp = tp;
|
||||||
return wp;
|
return wp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user