summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-27 17:10:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-27 17:10:57 +0800
commitde4baa7d9d874b81a4278a1e00a9f9548ba930ff (patch)
tree510774122de1c0a29c0b4589b87894747878da83 /script/files.lua
parent85b7d3fab81eea8f010d127230159fa7f458a984 (diff)
downloadlua-language-server-de4baa7d9d874b81a4278a1e00a9f9548ba930ff.zip
fix signature broken
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/script/files.lua b/script/files.lua
index 7e14bd9c..52f2b18a 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -438,7 +438,7 @@ function m.offset(uri, position)
if start <= 0 or start > #text then
offset = #text + 2
else
- offset = utf8.offset(text, position.character + 1, start) or (#text + 1)
+ offset = utf8.offset(text, position.character + 1, start) or (#text + 2)
end
if file._diffInfo then
offset = smerger.getOffset(file._diffInfo, offset)
@@ -467,7 +467,7 @@ function m.offsetOfWord(uri, position)
if start <= 0 or start > #text then
offset = #text + 2
else
- offset = utf8.offset(text, position.character + 1, start) or (#text + 1)
+ offset = utf8.offset(text, position.character + 1, start) or (#text + 2)
end
if offset > #text
or text:sub(offset-1, offset):match '[%w_][^%w_]' then
@@ -476,7 +476,7 @@ function m.offsetOfWord(uri, position)
if file._diffInfo then
offset = smerger.getOffset(file._diffInfo, offset)
end
- return offset
+ return offset - 1
end
--- 将应用差异前的offset转换为应用差异后的offset