summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-26 10:36:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-26 10:36:55 +0800
commit4e806aa1f0ba695ae6c5606813029428b472f5ca (patch)
tree8478f14c65b36dd49d2e7fdfec9e0a5cfaf7f3a2 /script/files.lua
parentffca749f6ff7269ea52ab26a7836f18226740da2 (diff)
downloadlua-language-server-4e806aa1f0ba695ae6c5606813029428b472f5ca.zip
#398 try fix offset of 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 fb7487bf..67cc4840 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
+ offset = #text + 1
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
+ offset = #text + 1
else
offset = utf8.offset(text, position.character + 1, start) or #text
end