1
0
forked from aniani/vim

patch 7.4.1558

Problem:    It is not easy to find out what windows display a buffer.
Solution:   Add win_findbuf().
This commit is contained in:
Bram Moolenaar
2016-03-13 19:04:51 +01:00
parent 86edef664e
commit 9cdf86b86f
6 changed files with 43 additions and 0 deletions

View File

@@ -7297,4 +7297,19 @@ win_id2win(typval_T *argvars)
}
return 0;
}
void
win_findbuf(typval_T *argvars, list_T *list)
{
win_T *wp;
tabpage_T *tp;
int bufnr = get_tv_number(&argvars[0]);
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
for (wp = tp == curtab ? firstwin : tp->tp_firstwin;
wp != NULL; wp = wp->w_next)
if (wp->w_buffer->b_fnum == bufnr)
list_append_number(list, wp->w_id);
}
#endif