summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-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