Mercurial > vim
diff src/evalfunc.c @ 14587:d33220d3bc27 v8.1.0307
patch 8.1.0307: there is no good way to get the window layout
commit https://github.com/vim/vim/commit/0f6b4f06dece71487a6d8546c50de775d9c8c287
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 21 16:56:34 2018 +0200
patch 8.1.0307: there is no good way to get the window layout
Problem: There is no good way to get the window layout.
Solution: Add the winlayout() function. (Yegappan Lakshmanan)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 21 Aug 2018 17:00:06 +0200 |
parents | 80f715651c4c |
children | 72d6f6f7ead7 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -463,6 +463,7 @@ static void f_win_screenpos(typval_T *ar static void f_winbufnr(typval_T *argvars, typval_T *rettv); static void f_wincol(typval_T *argvars, typval_T *rettv); static void f_winheight(typval_T *argvars, typval_T *rettv); +static void f_winlayout(typval_T *argvars, typval_T *rettv); static void f_winline(typval_T *argvars, typval_T *rettv); static void f_winnr(typval_T *argvars, typval_T *rettv); static void f_winrestcmd(typval_T *argvars, typval_T *rettv); @@ -952,6 +953,7 @@ static struct fst {"winbufnr", 1, 1, f_winbufnr}, {"wincol", 0, 0, f_wincol}, {"winheight", 1, 1, f_winheight}, + {"winlayout", 0, 1, f_winlayout}, {"winline", 0, 0, f_winline}, {"winnr", 0, 1, f_winnr}, {"winrestcmd", 0, 0, f_winrestcmd}, @@ -13743,6 +13745,29 @@ f_winheight(typval_T *argvars, typval_T } /* + * "winlayout()" function + */ + static void +f_winlayout(typval_T *argvars, typval_T *rettv) +{ + tabpage_T *tp; + + if (rettv_list_alloc(rettv) != OK) + return; + + if (argvars[0].v_type == VAR_UNKNOWN) + tp = curtab; + else + { + tp = find_tabpage((int)get_tv_number(&argvars[0])); + if (tp == NULL) + return; + } + + get_framelayout(tp->tp_topframe, rettv->vval.v_list, TRUE); +} + +/* * "winline()" function */ static void