mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	fix(mouse): early return when clicking in padded 'statuscolumn' (#29394)
Problem:  Hit assert when clicking inside a padded 'statuscolumn' that
          is padded beyond the length of the allocated click_defs.
Solution: Still consider this a "in_statuscol" click, but return early
          when about to execute the click func.
			
			
This commit is contained in:
		@@ -688,6 +688,9 @@ popupexit:
 | 
				
			|||||||
    if (in_statuscol && wp->w_p_rl) {
 | 
					    if (in_statuscol && wp->w_p_rl) {
 | 
				
			||||||
      click_col = wp->w_width_inner - click_col - 1;
 | 
					      click_col = wp->w_width_inner - click_col - 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (in_statuscol && click_col >= (int)wp->w_statuscol_click_defs_size) {
 | 
				
			||||||
 | 
					      return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (click_defs != NULL) {
 | 
					    if (click_defs != NULL) {
 | 
				
			||||||
      switch (click_defs[click_col].type) {
 | 
					      switch (click_defs[click_col].type) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,6 +91,10 @@ describe('statuscolumn', function()
 | 
				
			|||||||
      {8:2    }aaaaa                                           |
 | 
					      {8:2    }aaaaa                                           |
 | 
				
			||||||
                                                           |
 | 
					                                                           |
 | 
				
			||||||
    ]])
 | 
					    ]])
 | 
				
			||||||
 | 
					    -- Doesn't crash when clicking inside padded area without click_defs
 | 
				
			||||||
 | 
					    command('set numberwidth=10')
 | 
				
			||||||
 | 
					    api.nvim_input_mouse('left', 'press', '', 0, 0, 5)
 | 
				
			||||||
 | 
					    assert_alive()
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it("works with 'number' and 'relativenumber'", function()
 | 
					  it("works with 'number' and 'relativenumber'", function()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user