Try to fix col adjustment (#843)

* Try to fix col adjuastment

* Improve duplicated text handling
This commit is contained in:
hrsh7th
2022-03-17 15:53:10 +09:00
committed by GitHub
parent c60cb7a100
commit 71d7f46b93
2 changed files with 7 additions and 5 deletions

View File

@@ -260,10 +260,12 @@ entry.get_vim_item = function(self, suggest_offset)
end
-- remove duplicated string.
for i = 1, #word - 1 do
if str.has_prefix(self.context.cursor_after_line, string.sub(word, i, #word)) then
word = string.sub(word, 1, i - 1)
break
if self:get_offset() ~= self.context.cursor.col then
for i = 1, #word - 1 do
if str.has_prefix(self.context.cursor_after_line, string.sub(word, i, #word)) then
word = string.sub(word, 1, i - 1)
break
end
end
end