Skip to content

Commit fc348da

Browse files
committed
fix: guess text edit once and for all
1 parent 84361bd commit fc348da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lua/blink/cmp/accept/text-edits.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ function text_edits.guess_text_edit(bufnr, item)
4848

4949
-- Search forward/backward for the start/end of the word
5050
local start_col = current_col
51-
while start_col > 1 do
52-
local char = line:sub(start_col - 1, start_col - 1)
51+
while start_col > 0 do
52+
local char = line:sub(start_col, start_col)
5353
if char:match('[%w_\\-]') == nil then break end
5454
start_col = start_col - 1
5555
end
5656

5757
-- convert to 0-index
5858
return {
5959
range = {
60-
start = { line = current_line - 1, character = start_col - 1 },
60+
start = { line = current_line - 1, character = start_col },
6161
['end'] = { line = current_line - 1, character = current_col },
6262
},
6363
newText = word,

0 commit comments

Comments
 (0)