aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-09-13 14:05:34 +0200
committerGitHub <noreply@github.com>2016-09-13 14:05:34 +0200
commit7eb4d2f79dcc712dae1513516b9db5f574d51437 (patch)
tree044ffb8deb0b2b4b14fa189624516640986df939 /src/nvim/window.c
parenta34d3a7244f21c3d9494dd04f77346991ae24ae5 (diff)
downloadrneovim-7eb4d2f79dcc712dae1513516b9db5f574d51437.tar.gz
rneovim-7eb4d2f79dcc712dae1513516b9db5f574d51437.tar.bz2
rneovim-7eb4d2f79dcc712dae1513516b9db5f574d51437.zip
vim-patch:7.4.1558 (#5333)
Problem: It is not easy to find out what windows display a buffer. Solution: Add win_findbuf(). https://github.com/vim/vim/commit/9cdf86b86f5fdb5a45b682f336846f9d9a9c6f1f
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2e97cb2c3e..386867a08f 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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);
+ }
+ }
+ }
+}