mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	test: add test for key following ignored mouse move (#31104)
This commit is contained in:
		| @@ -289,8 +289,8 @@ size_t input_enqueue(String keys) | ||||
|     unsigned new_size | ||||
|       = trans_special(&ptr, (size_t)(end - ptr), (char *)buf, FSK_KEYCODE, true, NULL); | ||||
|  | ||||
|     if (new_size) { | ||||
|       if ((new_size = handle_mouse_event(&ptr, buf, new_size))) { | ||||
|     if (new_size > 0) { | ||||
|       if ((new_size = handle_mouse_event(&ptr, buf, new_size)) > 0) { | ||||
|         input_enqueue_raw((char *)buf, new_size); | ||||
|       } | ||||
|       continue; | ||||
| @@ -351,9 +351,9 @@ static uint8_t check_multiclick(int code, int grid, int row, int col, bool *skip | ||||
|              || code == KE_X1MOUSE || code == KE_X2MOUSE) { | ||||
|     // For click events the number of clicks is updated. | ||||
|     uint64_t mouse_time = os_hrtime();    // time of current mouse click (ns) | ||||
|     // compute the time elapsed since the previous mouse click and | ||||
|     // convert p_mouse from ms to ns | ||||
|     // Compute the time elapsed since the previous mouse click. | ||||
|     uint64_t timediff = mouse_time - orig_mouse_time; | ||||
|     // Convert 'mousetime' from ms to ns. | ||||
|     uint64_t mouset = (uint64_t)p_mouset * 1000000; | ||||
|     if (code == orig_mouse_code | ||||
|         && no_move | ||||
| @@ -407,7 +407,7 @@ static unsigned handle_mouse_event(const char **ptr, uint8_t *buf, unsigned bufs | ||||
|     return bufsize; | ||||
|   } | ||||
|  | ||||
|   // a <[COL],[ROW]> sequence can follow and will set the mouse_row/mouse_col | ||||
|   // A <[COL],[ROW]> sequence can follow and will set the mouse_row/mouse_col | ||||
|   // global variables. This is ugly but its how the rest of the code expects to | ||||
|   // find mouse coordinates, and it would be too expensive to refactor this | ||||
|   // now. | ||||
|   | ||||
| @@ -1922,17 +1922,24 @@ describe('ui/mouse/input', function() | ||||
|   end) | ||||
|  | ||||
|   it('<MouseMove> to same location does not generate events #31103', function() | ||||
|     api.nvim_input_mouse('move', '', '', 0, 0, 3) | ||||
|     api.nvim_set_var('mouse_move', 0) | ||||
|     api.nvim_set_var('mouse_move2', 0) | ||||
|     command('nnoremap <MouseMove> <Cmd>let g:mouse_move += 1<CR>') | ||||
|     command('nnoremap <2-MouseMove> <Cmd>let g:mouse_move2 += 1<CR>') | ||||
|     feed('<MouseMove><3,0>') | ||||
|     feed('<MouseMove><3,0>') | ||||
|     api.nvim_input_mouse('move', '', '', 0, 0, 3) | ||||
|     api.nvim_input_mouse('move', '', '', 0, 0, 3) | ||||
|     eq(0, api.nvim_get_var('mouse_move')) | ||||
|     eq(1, api.nvim_get_var('mouse_move')) | ||||
|     eq(0, api.nvim_get_var('mouse_move2')) | ||||
|     feed('<MouseMove><3,0>') | ||||
|     feed('<MouseMove><3,0>') | ||||
|     api.nvim_input_mouse('move', '', '', 0, 0, 3) | ||||
|     api.nvim_input_mouse('move', '', '', 0, 0, 3) | ||||
|     eq(1, api.nvim_get_var('mouse_move')) | ||||
|     eq(0, api.nvim_get_var('mouse_move2')) | ||||
|     eq({ mode = 'n', blocking = false }, api.nvim_get_mode()) | ||||
|     feed('<MouseMove><3,0><Insert>') | ||||
|     eq(1, api.nvim_get_var('mouse_move')) | ||||
|     eq(0, api.nvim_get_var('mouse_move2')) | ||||
|     eq({ mode = 'i', blocking = false }, api.nvim_get_mode()) | ||||
|   end) | ||||
|  | ||||
|   it('feeding <MouseMove> in Normal mode does not use uninitialized memory #19480', function() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq