summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-01 16:12:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-01 16:12:49 +0800
commitda4ddec0289d7d72ce53816259cbfb0069353ab1 (patch)
tree1ac6033fbdb094acfdf0ecef8f0166615e186501 /script/files.lua
parentbf8a629270d9e259f0149fa9d4af08d6135eaff5 (diff)
downloadlua-language-server-da4ddec0289d7d72ce53816259cbfb0069353ab1.zip
#398 fix didChange at eof
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/script/files.lua b/script/files.lua
index 67cc4840..220a2ee2 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -538,7 +538,7 @@ function m.offset(uri, position, isFinish)
local start = guide.lineRange(lines, row)
local offset
if start <= 0 or start > #text then
- offset = #text + 1
+ offset = math.maxinteger
else
offset = utf8.offset(text, position.character + 1, start) or #text
end
@@ -572,7 +572,7 @@ function m.offsetOfWord(uri, position)
local start = guide.lineRange(lines, row)
local offset
if start <= 0 or start > #text then
- offset = #text + 1
+ offset = math.maxinteger
else
offset = utf8.offset(text, position.character + 1, start) or #text
end