vim-patch:7.4.1558 (#5333)

Problem:    It is not easy to find out what windows display a buffer.
Solution:   Add win_findbuf().

9cdf86b86f
This commit is contained in:
Justin M. Keyes
2016-09-13 14:05:34 +02:00
committed by GitHub
parent a34d3a7244
commit 7eb4d2f79d
6 changed files with 37 additions and 1 deletions

View File

@@ -5771,3 +5771,17 @@ int win_id2win(typval_T *argvars)
}
return 0;
}
void win_findbuf(typval_T *argvars, list_T *list)
{
int bufnr = get_tv_number(&argvars[0]);
for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
for (win_T *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->handle);
}
}
}
}