diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-25 20:02:35 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-25 20:02:35 +0800 |
commit | 025fb18d576f2edb0863ab2d69f4f30db3fab835 (patch) | |
tree | 9715a96cfbec207a88cb48b1a8e4f9a288568adf /script-beta/proto/define.lua | |
parent | 8d88695d3897384cdee001f49b702a1a3586597b (diff) | |
download | lua-language-server-025fb18d576f2edb0863ab2d69f4f30db3fab835.zip |
#234 修错了
Diffstat (limited to 'script-beta/proto/define.lua')
-rw-r--r-- | script-beta/proto/define.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/script-beta/proto/define.lua b/script-beta/proto/define.lua index 3afd5dc7..124ca42c 100644 --- a/script-beta/proto/define.lua +++ b/script-beta/proto/define.lua @@ -11,8 +11,8 @@ local m = {} function m.offset(lines, text, position) local row = position.line + 1 local start = guide.lineRange(lines, row) - if start >= #text then - return 0 + if start > #text then + return #text + 1 end local offset = utf8.offset(text, position.character + 1, start) return offset - 1 @@ -26,8 +26,8 @@ end function m.offsetOfWord(lines, text, position) local row = position.line + 1 local start = guide.lineRange(lines, row) - if start >= #text then - return 0 + if start > #text then + return #text + 1 end local offset = utf8.offset(text, position.character + 1, start) if offset > #text |