Skip to content

Commit

Permalink
fix: incorrect context start_col 1 char after beginning of line
Browse files Browse the repository at this point in the history
Closes #405
  • Loading branch information
Saghen committed Dec 2, 2024
1 parent 96ceb56 commit e88da6a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/blink/cmp/completion/trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,15 @@ function trigger.get_context_bounds(regex)

local line = vim.api.nvim_buf_get_lines(0, cursor_line - 1, cursor_line, false)[1]
local start_col = cursor_col
while start_col > 1 do
while start_col >= 1 do
local char = line:sub(start_col, start_col)
if char:match(regex) == nil then
start_col = start_col + 1
break
end
start_col = start_col - 1
end
start_col = math.max(start_col, 1)

local end_col = cursor_col
while end_col < #line do
Expand Down

0 comments on commit e88da6a

Please sign in to comment.