diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-08 21:26:09 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-08 21:26:09 +0800 |
commit | 9881e7cd087deb3cdba2eae2071fcfd955d27477 (patch) | |
tree | 6f9a4a9e48d8a428f61965f5424bfeff4ac07662 /script/files.lua | |
parent | 0be605ef1eab73a662540ae2f02766aee47149eb (diff) | |
download | lua-language-server-9881e7cd087deb3cdba2eae2071fcfd955d27477.zip |
fix tests
Diffstat (limited to 'script/files.lua')
-rw-r--r-- | script/files.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/script/files.lua b/script/files.lua index a25c94c6..745c5354 100644 --- a/script/files.lua +++ b/script/files.lua @@ -539,10 +539,9 @@ function m.offset(uri, position, isFinish) local row = position.line + 1 local start = guide.lineRange(lines, row) local offset - if start <= 0 then - offset = 0 - elseif start > #text then - offset = start + -- TODO + if start <= 0 or start > #text then + offset = math.maxinteger else offset = utf8.offset(text, position.character + 1, start) or #text end |