Skip to content

Commit 9bdd828

Browse files
committed
fix: documentation width
1 parent b0815e4 commit 9bdd828

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function win:get_border_size(border)
147147
if border == 'none' then
148148
return { vertical = 0, horizontal = 0, left = 0, right = 0, top = 0, bottom = 0 }
149149
elseif border == 'padded' then
150-
return { vertical = 0, horizontal = 1, left = 1, right = 0, top = 0, bottom = 0 }
150+
return { vertical = 0, horizontal = 2, left = 1, right = 1, top = 0, bottom = 0 }
151151
elseif border == 'shadow' then
152152
return { vertical = 1, horizontal = 1, left = 0, right = 1, top = 0, bottom = 1 }
153153
elseif type(border) == 'string' then
@@ -225,7 +225,7 @@ function win:get_vertical_direction_and_height(direction_priority)
225225
local direction_priority_by_space = vim.fn.sort(vim.deepcopy(direction_priority), function(a, b)
226226
local distance_a = math.min(max_height, get_distance(a))
227227
local distance_b = math.min(max_height, get_distance(b))
228-
return distance_a < distance_b
228+
return distance_a < distance_b and -1 or distance_a > distance_b and 1 or 0
229229
end)
230230

231231
local direction = direction_priority_by_space[1]
@@ -237,7 +237,7 @@ end
237237
function win:get_direction_with_window_constraints(anchor_win, direction_priority)
238238
local cursor_constraints = self.get_cursor_screen_position()
239239
local anchor_config = vim.fn.screenpos(anchor_win:get_win(), 1, 1)
240-
local anchor_border_size = self:get_border_size(anchor_config.border)
240+
local anchor_border_size = anchor_win:get_border_size()
241241
local anchor_col = anchor_config.col - anchor_border_size.left
242242
local anchor_row = anchor_config.row - anchor_border_size.top
243243
local anchor_height = anchor_win:get_height()
@@ -254,17 +254,17 @@ function win:get_direction_with_window_constraints(anchor_win, direction_priorit
254254
local direction_constraints = {
255255
n = {
256256
vertical = anchor_is_above_cursor and (anchor_row - 1) or cursor_constraints.distance_from_top,
257-
horizontal = screen_width - anchor_col + 1,
257+
horizontal = screen_width - (anchor_col - 1),
258258
},
259259
s = {
260260
vertical = anchor_is_above_cursor and cursor_constraints.distance_from_bottom
261261
or (screen_height - (anchor_height + anchor_row - 1)),
262-
horizontal = screen_width - anchor_col + 1,
262+
horizontal = screen_width - (anchor_col - 1),
263263
},
264264
e = {
265265
vertical = anchor_is_above_cursor and cursor_constraints.distance_from_top
266266
or cursor_constraints.distance_from_bottom,
267-
horizontal = screen_width - (anchor_col + anchor_width - 1),
267+
horizontal = screen_width - (anchor_col - 1) - anchor_width,
268268
},
269269
w = {
270270
vertical = anchor_is_above_cursor and cursor_constraints.distance_from_top
@@ -280,7 +280,7 @@ function win:get_direction_with_window_constraints(anchor_win, direction_priorit
280280
local constraints_b = direction_constraints[b]
281281
local distance_a = math.min(max_height, constraints_a.vertical, constraints_a.horizontal)
282282
local distance_b = math.min(max_height, constraints_b.vertical, constraints_b.horizontal)
283-
return distance_a < distance_b
283+
return distance_a < distance_b and -1 or distance_a > distance_b and 1 or 0
284284
end)
285285

286286
local border_size = self:get_border_size()

0 commit comments

Comments
 (0)