mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(mouse): click on 'statuscolumn' with 'rightleft' (#25090)
This commit is contained in:
		| @@ -220,7 +220,10 @@ static int get_fpos_of_mouse(pos_T *mpos) | |||||||
|   // compute the position in the buffer line from the posn on the screen |   // compute the position in the buffer line from the posn on the screen | ||||||
|   bool below_buffer = mouse_comp_pos(wp, &row, &col, &mpos->lnum); |   bool below_buffer = mouse_comp_pos(wp, &row, &col, &mpos->lnum); | ||||||
|  |  | ||||||
|   if (!below_buffer && *wp->w_p_stc != NUL && mouse_col < win_col_off(wp)) { |   if (!below_buffer && *wp->w_p_stc != NUL | ||||||
|  |       && (wp->w_p_rl | ||||||
|  |           ? wincol >= wp->w_width_inner - win_col_off(wp) | ||||||
|  |           : wincol < win_col_off(wp))) { | ||||||
|     return MOUSE_STATUSCOL; |     return MOUSE_STATUSCOL; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -675,6 +678,10 @@ popupexit: | |||||||
|       click_col = mouse_col; |       click_col = mouse_col; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (in_statuscol && wp->w_p_rl) { | ||||||
|  |       click_col = wp->w_width_inner - click_col - 1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (click_defs != NULL) { |     if (click_defs != NULL) { | ||||||
|       switch (click_defs[click_col].type) { |       switch (click_defs[click_col].type) { | ||||||
|       case kStlClickDisabled: |       case kStlClickDisabled: | ||||||
| @@ -1254,7 +1261,10 @@ retnomove: | |||||||
|   on_sep_line = grid == DEFAULT_GRID_HANDLE && col >= wp->w_width && col - wp->w_width + 1 == 1; |   on_sep_line = grid == DEFAULT_GRID_HANDLE && col >= wp->w_width && col - wp->w_width + 1 == 1; | ||||||
|   on_winbar = row == -1 && wp->w_winbar_height != 0; |   on_winbar = row == -1 && wp->w_winbar_height != 0; | ||||||
|   on_statuscol = !below_window && !on_status_line && !on_sep_line && !on_winbar |   on_statuscol = !below_window && !on_status_line && !on_sep_line && !on_winbar | ||||||
|                  && *wp->w_p_stc != NUL && col < win_col_off(wp); |                  && *wp->w_p_stc != NUL | ||||||
|  |                  && (wp->w_p_rl | ||||||
|  |                      ? col >= wp->w_width_inner - win_col_off(wp) | ||||||
|  |                      : col < win_col_off(wp)); | ||||||
|  |  | ||||||
|   // The rightmost character of the status line might be a vertical |   // The rightmost character of the status line might be a vertical | ||||||
|   // separator character if there is no connecting window to the right. |   // separator character if there is no connecting window to the right. | ||||||
|   | |||||||
| @@ -532,6 +532,24 @@ describe('statuscolumn', function() | |||||||
|         eq('0 3 r 7', eval("g:testvar")) |         eq('0 3 r 7', eval("g:testvar")) | ||||||
|         meths.input_mouse('right', 'press', '', 0, 3, 0) |         meths.input_mouse('right', 'press', '', 0, 3, 0) | ||||||
|         eq('0 4 r 7', eval("g:testvar")) |         eq('0 4 r 7', eval("g:testvar")) | ||||||
|  |  | ||||||
|  |         command('rightbelow vsplit') | ||||||
|  |         meths.input_mouse('left', 'press', '', 0, 0, 27) | ||||||
|  |         eq('0 1 l 4', eval("g:testvar")) | ||||||
|  |         meths.input_mouse('right', 'press', '', 0, 3, 27) | ||||||
|  |         eq('0 1 r 7', eval("g:testvar")) | ||||||
|  |         command('setlocal rightleft') | ||||||
|  |         meths.input_mouse('left', 'press', '', 0, 0, 52) | ||||||
|  |         eq('0 1 l 4', eval("g:testvar")) | ||||||
|  |         meths.input_mouse('right', 'press', '', 0, 3, 52) | ||||||
|  |         eq('0 1 r 7', eval("g:testvar")) | ||||||
|  |         command('wincmd H') | ||||||
|  |         meths.input_mouse('left', 'press', '', 0, 0, 25) | ||||||
|  |         eq('0 1 l 4', eval("g:testvar")) | ||||||
|  |         meths.input_mouse('right', 'press', '', 0, 3, 25) | ||||||
|  |         eq('0 1 r 7', eval("g:testvar")) | ||||||
|  |         command('close') | ||||||
|  |  | ||||||
|         command('set laststatus=2 winbar=%f') |         command('set laststatus=2 winbar=%f') | ||||||
|         command('let g:testvar = ""') |         command('let g:testvar = ""') | ||||||
|         -- Check that winbar click doesn't register as statuscolumn click |         -- Check that winbar click doesn't register as statuscolumn click | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq