diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-05-26 16:33:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-26 16:33:10 +0200 |
commit | 2b4c0181ba5a064b13f4e96e364124245e6f494c (patch) | |
tree | 5235096650cc259e01ecc1c5af2c88eaafacc0a6 /src/nvim/window.c | |
parent | 52215f57526f27c7752685ae280865ae71105969 (diff) | |
parent | 58d6e2d3cc4c39f7a2c78a3060758bee31f831e4 (diff) | |
download | rneovim-2b4c0181ba5a064b13f4e96e364124245e6f494c.tar.gz rneovim-2b4c0181ba5a064b13f4e96e364124245e6f494c.tar.bz2 rneovim-2b4c0181ba5a064b13f4e96e364124245e6f494c.zip |
Merge #10064 from janlazo/vim-8.1.0211
vim-patch:8.1.{211,307}
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 2ce3b7067b..e6b19cf88d 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6658,6 +6658,41 @@ void win_findbuf(typval_T *argvars, list_T *list) } } +// Get the layout of the given tab page for winlayout(). +void get_framelayout(const frame_T *fr, list_T *l, bool outer) +{ + list_T *fr_list; + + if (fr == NULL) { + return; + } + + if (outer) { + // outermost call from f_winlayout() + fr_list = l; + } else { + fr_list = tv_list_alloc(2); + tv_list_append_list(l, fr_list); + } + + if (fr->fr_layout == FR_LEAF) { + if (fr->fr_win != NULL) { + tv_list_append_string(fr_list, "leaf", -1); + tv_list_append_number(fr_list, fr->fr_win->handle); + } + } else { + tv_list_append_string(fr_list, fr->fr_layout == FR_ROW ? "row" : "col", -1); + + list_T *const win_list = tv_list_alloc(kListLenUnknown); + tv_list_append_list(fr_list, win_list); + const frame_T *child = fr->fr_child; + while (child != NULL) { + get_framelayout(child, win_list, false); + child = child->fr_next; + } + } +} + void win_ui_flush_positions(void) { FOR_ALL_TAB_WINDOWS(tp, wp) { |