Skip to content

Commit cb0baa4

Browse files
committed
fix: documentation misplacement due to screenpos returning 0,0
1 parent d3e1c92 commit cb0baa4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lua/blink/cmp/windows/lib/init.lua

+9
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,16 @@ end
238238

239239
function win:get_direction_with_window_constraints(anchor_win, direction_priority)
240240
local cursor_constraints = self.get_cursor_screen_position()
241+
241242
local anchor_config = vim.fn.screenpos(anchor_win:get_win(), 1, 1)
243+
-- hack: sometimes vin.fn.screenpos returns 0,0
244+
-- https://github.com/neovim/neovim/pull/30681
245+
if anchor_config.row == 0 and anchor_config.col == 0 then
246+
local row, col = unpack(vim.fn.win_screenpos(anchor_win:get_win()))
247+
anchor_config.row = row
248+
anchor_config.col = col
249+
end
250+
242251
local anchor_border_size = anchor_win:get_border_size()
243252
local anchor_col = anchor_config.col - anchor_border_size.left
244253
local anchor_row = anchor_config.row - anchor_border_size.top

0 commit comments

Comments
 (0)