vim-patch:8.0.1364: there is no easy way to get the window position

Problem:    There is no easy way to get the window position.
Solution:   Add win_screenpos().
22044dc317
This commit is contained in:
Jan Edmund Lazo
2018-08-15 11:53:38 -04:00
parent b5cfac0894
commit b89c08901c
4 changed files with 32 additions and 0 deletions

View File

@@ -10310,6 +10310,15 @@ static void f_getwininfo(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
// "win_screenpos()" function
static void f_win_screenpos(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
tv_list_alloc_ret(rettv, 2);
const win_T *const wp = find_win_by_nr(&argvars[0], NULL);
tv_list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1);
tv_list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1);
}
/*
* "getwinposx()" function
*/