Mercurial > vim
comparison src/evalfunc.c @ 12977:2d817fd289ba v8.0.1364
patch 8.0.1364: there is no easy way to get the window position
commit https://github.com/vim/vim/commit/22044dc31788d9f1c2da7725269884d9923b4795
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 2 15:43:37 2017 +0100
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().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 02 Dec 2017 15:45:04 +0100 |
parents | 8ba2a921cd86 |
children | 58cce40c965b |
comparison
equal
deleted
inserted
replaced
12976:1a4d7b63c490 | 12977:2d817fd289ba |
---|---|
439 static void f_win_findbuf(typval_T *argvars, typval_T *rettv); | 439 static void f_win_findbuf(typval_T *argvars, typval_T *rettv); |
440 static void f_win_getid(typval_T *argvars, typval_T *rettv); | 440 static void f_win_getid(typval_T *argvars, typval_T *rettv); |
441 static void f_win_gotoid(typval_T *argvars, typval_T *rettv); | 441 static void f_win_gotoid(typval_T *argvars, typval_T *rettv); |
442 static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv); | 442 static void f_win_id2tabwin(typval_T *argvars, typval_T *rettv); |
443 static void f_win_id2win(typval_T *argvars, typval_T *rettv); | 443 static void f_win_id2win(typval_T *argvars, typval_T *rettv); |
444 static void f_win_screenpos(typval_T *argvars, typval_T *rettv); | |
444 static void f_winbufnr(typval_T *argvars, typval_T *rettv); | 445 static void f_winbufnr(typval_T *argvars, typval_T *rettv); |
445 static void f_wincol(typval_T *argvars, typval_T *rettv); | 446 static void f_wincol(typval_T *argvars, typval_T *rettv); |
446 static void f_winheight(typval_T *argvars, typval_T *rettv); | 447 static void f_winheight(typval_T *argvars, typval_T *rettv); |
447 static void f_winline(typval_T *argvars, typval_T *rettv); | 448 static void f_winline(typval_T *argvars, typval_T *rettv); |
448 static void f_winnr(typval_T *argvars, typval_T *rettv); | 449 static void f_winnr(typval_T *argvars, typval_T *rettv); |
897 {"win_findbuf", 1, 1, f_win_findbuf}, | 898 {"win_findbuf", 1, 1, f_win_findbuf}, |
898 {"win_getid", 0, 2, f_win_getid}, | 899 {"win_getid", 0, 2, f_win_getid}, |
899 {"win_gotoid", 1, 1, f_win_gotoid}, | 900 {"win_gotoid", 1, 1, f_win_gotoid}, |
900 {"win_id2tabwin", 1, 1, f_win_id2tabwin}, | 901 {"win_id2tabwin", 1, 1, f_win_id2tabwin}, |
901 {"win_id2win", 1, 1, f_win_id2win}, | 902 {"win_id2win", 1, 1, f_win_id2win}, |
903 {"win_screenpos", 1, 1, f_win_screenpos}, | |
902 {"winbufnr", 1, 1, f_winbufnr}, | 904 {"winbufnr", 1, 1, f_winbufnr}, |
903 {"wincol", 0, 0, f_wincol}, | 905 {"wincol", 0, 0, f_wincol}, |
904 {"winheight", 1, 1, f_winheight}, | 906 {"winheight", 1, 1, f_winheight}, |
905 {"winline", 0, 0, f_winline}, | 907 {"winline", 0, 0, f_winline}, |
906 {"winnr", 0, 1, f_winnr}, | 908 {"winnr", 0, 1, f_winnr}, |
5374 */ | 5376 */ |
5375 static void | 5377 static void |
5376 f_win_id2win(typval_T *argvars, typval_T *rettv) | 5378 f_win_id2win(typval_T *argvars, typval_T *rettv) |
5377 { | 5379 { |
5378 rettv->vval.v_number = win_id2win(argvars); | 5380 rettv->vval.v_number = win_id2win(argvars); |
5381 } | |
5382 | |
5383 /* | |
5384 * "win_screenpos()" function | |
5385 */ | |
5386 static void | |
5387 f_win_screenpos(typval_T *argvars, typval_T *rettv) | |
5388 { | |
5389 win_T *wp; | |
5390 | |
5391 if (rettv_list_alloc(rettv) == FAIL) | |
5392 return; | |
5393 | |
5394 wp = find_win_by_nr(&argvars[0], NULL); | |
5395 list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_winrow + 1); | |
5396 list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1); | |
5379 } | 5397 } |
5380 | 5398 |
5381 /* | 5399 /* |
5382 * "getwinposx()" function | 5400 * "getwinposx()" function |
5383 */ | 5401 */ |