mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(lsp): account for border height in max floating popup height (#25539)
This commit is contained in:
		| @@ -1100,13 +1100,14 @@ function M.make_floating_popup_options(width, height, opts) | |||||||
|     anchor_below = lines_below > lines_above |     anchor_below = lines_below > lines_above | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   local border_height = get_border_size(opts).height | ||||||
|   if anchor_below then |   if anchor_below then | ||||||
|     anchor = anchor .. 'N' |     anchor = anchor .. 'N' | ||||||
|     height = math.min(lines_below, height) |     height = math.max(math.min(lines_below - border_height, height), 0) | ||||||
|     row = 1 |     row = 1 | ||||||
|   else |   else | ||||||
|     anchor = anchor .. 'S' |     anchor = anchor .. 'S' | ||||||
|     height = math.min(lines_above, height) |     height = math.max(math.min(lines_above - border_height, height), 0) | ||||||
|     row = 0 |     row = 0 | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -212,6 +212,14 @@ describe('vim.lsp.util', function() | |||||||
|       it('places window below for anchor_bias = "below"', function () |       it('places window below for anchor_bias = "below"', function () | ||||||
|         assert_anchor('below', 'N') |         assert_anchor('below', 'N') | ||||||
|       end) |       end) | ||||||
|  |  | ||||||
|  |       it('bordered window truncates dimensions correctly', function () | ||||||
|  |         local opts = exec_lua([[ | ||||||
|  |           return vim.lsp.util.make_floating_popup_options(100, 100, { border = 'single' }) | ||||||
|  |         ]]) | ||||||
|  |  | ||||||
|  |         eq(56, opts.height) | ||||||
|  |       end) | ||||||
|     end) |     end) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 LW
					LW