mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	multigrid: use grid-based coordinates for ext_popupmenu
This commit is contained in:
		| @@ -87,7 +87,8 @@ void win_position(Integer win, Integer grid, Integer startrow, | |||||||
|                   Integer startcol, Integer width, Integer height) |                   Integer startcol, Integer width, Integer height) | ||||||
|   FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY; |   FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY; | ||||||
|  |  | ||||||
| void popupmenu_show(Array items, Integer selected, Integer row, Integer col) | void popupmenu_show(Array items, Integer selected, | ||||||
|  |                     Integer row, Integer col, Integer grid) | ||||||
|   FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; |   FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; | ||||||
| void popupmenu_hide(void) | void popupmenu_hide(void) | ||||||
|   FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; |   FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; | ||||||
|   | |||||||
| @@ -68,12 +68,12 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) | |||||||
|   int kind_width; |   int kind_width; | ||||||
|   int extra_width; |   int extra_width; | ||||||
|   int i; |   int i; | ||||||
|   int row; |  | ||||||
|   int context_lines; |   int context_lines; | ||||||
|   int col; |  | ||||||
|   int above_row; |   int above_row; | ||||||
|   int below_row; |   int below_row; | ||||||
|   int redo_count = 0; |   int redo_count = 0; | ||||||
|  |   int row; | ||||||
|  |   int col; | ||||||
|  |  | ||||||
|   if (!pum_is_visible) { |   if (!pum_is_visible) { | ||||||
|     // To keep the code simple, we only allow changing the |     // To keep the code simple, we only allow changing the | ||||||
| @@ -90,13 +90,20 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) | |||||||
|     below_row = cmdline_row; |     below_row = cmdline_row; | ||||||
|  |  | ||||||
|     // anchor position: the start of the completed word |     // anchor position: the start of the completed word | ||||||
|     row = curwin->w_wrow + curwin->w_winrow; |     row = curwin->w_wrow; | ||||||
|     if (curwin->w_p_rl) { |     if (curwin->w_p_rl) { | ||||||
|       col = curwin->w_wincol + curwin->w_width - curwin->w_wcol - 1; |       col = curwin->w_width - curwin->w_wcol - 1; | ||||||
|     } else { |     } else { | ||||||
|       col = curwin->w_wincol + curwin->w_wcol; |       col = curwin->w_wincol + curwin->w_wcol; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     int grid = (int)curwin->w_grid.handle; | ||||||
|  |     if (!ui_is_external(kUIMultigrid)) { | ||||||
|  |       grid = (int)default_grid.handle; | ||||||
|  |       row += curwin->w_winrow; | ||||||
|  |       col += curwin->w_wincol; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (pum_external) { |     if (pum_external) { | ||||||
|       if (array_changed) { |       if (array_changed) { | ||||||
|         Array arr = ARRAY_DICT_INIT; |         Array arr = ARRAY_DICT_INIT; | ||||||
| @@ -108,7 +115,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) | |||||||
|           ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_info))); |           ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_info))); | ||||||
|           ADD(arr, ARRAY_OBJ(item)); |           ADD(arr, ARRAY_OBJ(item)); | ||||||
|         } |         } | ||||||
|         ui_call_popupmenu_show(arr, selected, row, col); |         ui_call_popupmenu_show(arr, selected, row, col, grid); | ||||||
|       } else { |       } else { | ||||||
|         ui_call_popupmenu_select(selected); |         ui_call_popupmenu_select(selected); | ||||||
|       } |       } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Björn Linse
					Björn Linse