summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-13 19:04:51 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-13 19:04:51 +0100
commit9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f (patch)
tree905ddef78df904d3060bd749cf4c073dbeb1de78 /src/window.c
parent86edef664efccbfe685906c854b9cdd04e56f2d5 (diff)
downloadvim-git-9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f.tar.gz
patch 7.4.1558v7.4.1558
Problem: It is not easy to find out what windows display a buffer. Solution: Add win_findbuf().
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index b6111bd15..c6a6d2b84 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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