mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user