mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:8.0.1563: getwinposx() timeout #9955
Problem:    Timeout of getwinposx() can be too short. (lilydjwg)
Solution:   Add getwinpos(). (closes vim/vim#2689)
3f54fd319f
			
			
This commit is contained in:
		 Jan Edmund Lazo
					Jan Edmund Lazo
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						parent
						
							8aca932aa0
						
					
				
				
					commit
					a0d723db55
				
			| @@ -2114,8 +2114,8 @@ gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) | |||||||
| 				any	{name} in {winnr} in tab page {tabnr} | 				any	{name} in {winnr} in tab page {tabnr} | ||||||
| getwininfo([{winid}])		List	list of windows | getwininfo([{winid}])		List	list of windows | ||||||
| getwinpos([{timeout}])		List	X and Y coord in pixels of the Vim window | getwinpos([{timeout}])		List	X and Y coord in pixels of the Vim window | ||||||
| getwinposx()			Number	X coord in pixels of GUI Vim window | getwinposx()			Number	X coord in pixels of Vim window | ||||||
| getwinposy()			Number	Y coord in pixels of GUI Vim window | getwinposy()			Number	Y coord in pixels of Vim window | ||||||
| getwinvar({nr}, {varname} [, {def}]) | getwinvar({nr}, {varname} [, {def}]) | ||||||
| 				any	variable {varname} in window {nr} | 				any	variable {varname} in window {nr} | ||||||
| glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) | glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) | ||||||
| @@ -4550,6 +4550,13 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}])		*gettabwinvar()* | |||||||
| 		To obtain all window-local variables use: > | 		To obtain all window-local variables use: > | ||||||
| 			gettabwinvar({tabnr}, {winnr}, '&') | 			gettabwinvar({tabnr}, {winnr}, '&') | ||||||
|  |  | ||||||
|  | getwinpos([{timeout}])					*getwinpos()* | ||||||
|  | 		The result is a list with two numbers, the result of | ||||||
|  | 		getwinposx() and getwinposy() combined:  | ||||||
|  | 			[x-pos, y-pos] | ||||||
|  | 		{timeout} can be used to specify how long to wait in msec for | ||||||
|  | 		a response from the terminal.  When omitted 100 msec is used. | ||||||
|  |  | ||||||
| 							*getwinposx()* | 							*getwinposx()* | ||||||
| getwinposx()	The result is a Number, which is the X coordinate in pixels of | getwinposx()	The result is a Number, which is the X coordinate in pixels of | ||||||
| 		the left hand side of the GUI Vim window.  The result will be | 		the left hand side of the GUI Vim window.  The result will be | ||||||
|   | |||||||
| @@ -10474,6 +10474,14 @@ static void f_win_screenpos(typval_T *argvars, typval_T *rettv, FunPtr fptr) | |||||||
|   tv_list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1); |   tv_list_append_number(rettv->vval.v_list, wp == NULL ? 0 : wp->w_wincol + 1); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // "getwinpos({timeout})" function | ||||||
|  | static void f_getwinpos(typval_T *argvars, typval_T *rettv, FunPtr fptr) | ||||||
|  | { | ||||||
|  |   tv_list_alloc_ret(rettv, 2); | ||||||
|  |   tv_list_append_number(rettv->vval.v_list, -1); | ||||||
|  |   tv_list_append_number(rettv->vval.v_list, -1); | ||||||
|  | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * "getwinposx()" function |  * "getwinposx()" function | ||||||
|  */ |  */ | ||||||
|   | |||||||
| @@ -143,6 +143,7 @@ return { | |||||||
|     gettabvar={args={2, 3}}, |     gettabvar={args={2, 3}}, | ||||||
|     gettabwinvar={args={3, 4}}, |     gettabwinvar={args={3, 4}}, | ||||||
|     getwininfo={args={0, 1}}, |     getwininfo={args={0, 1}}, | ||||||
|  |     getwinpos={args={0, 1}}, | ||||||
|     getwinposx={}, |     getwinposx={}, | ||||||
|     getwinposy={}, |     getwinposy={}, | ||||||
|     getwinvar={args={2, 3}}, |     getwinvar={args={2, 3}}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user