/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * * Do ":help uganda" in Vim to read copying and usage conditions. * Do ":help credits" in Vim to see a list of people who contributed. * See README.txt for an overview of the Vim source code. *//* * evalwindow.c: Window related builtin functions */#include"vim.h"#if defined(FEAT_EVAL) || defined(PROTO)staticintwin_getid(typval_T*argvars){intwinnr;win_T*wp;if(argvars[0].v_type==VAR_UNKNOWN)returncurwin->w_id;winnr=tv_get_number(&argvars[0]);if(winnr<=0)return0;if(argvars[1].v_type==VAR_UNKNOWN)wp=firstwin;else{tabpage_T*tp;inttabnr=tv_get_number(&argvars[1]);FOR_ALL_TABPAGES(tp)if(--tabnr==0)break;if(tp==NULL)return-1;if(tp==curtab)wp=firstwin;elsewp=tp->tp_firstwin;}for(;wp!=NULL;wp=wp->w_next)if(--winnr==0)returnwp->w_id;return0;}staticvoidwin_id2tabwin(typval_T*argvars,list_T*list){win_T