autocomplete: properly replace current partial symbol

This commit is contained in:
jgmdev 2022-09-12 22:41:50 -04:00
parent 334ef427c1
commit bead59a898
1 changed files with 3 additions and 2 deletions

View File

@ -636,9 +636,10 @@ command.add(predicate, {
inserted = item.onselect(suggestions_idx, item)
end
if not inserted then
local current_partial = get_partial_symbol()
doc:insert(line, col, text)
doc:remove(line, col, line, col - #partial)
doc:set_selection(line, col + #text - #partial)
doc:remove(line, col, line, col - #current_partial)
doc:set_selection(line, col + #text - #current_partial)
end
reset_suggestions()
end,