diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-10-11 14:54:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-10-11 14:54:13 +0800 |
commit | 82c8a84cf0f69f659dbb85af3b068e7e4f81be7f (patch) | |
tree | 2633006f28c37ccd49ab0b96d9095821d4df1481 /script | |
parent | 85914dd67c44185a2111e5fccd589f4caa90d6b6 (diff) | |
download | lua-language-server-82c8a84cf0f69f659dbb85af3b068e7e4f81be7f.zip |
fix
Diffstat (limited to 'script')
-rw-r--r-- | script/proto/converter.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua index da0442fe..af75f080 100644 --- a/script/proto/converter.lua +++ b/script/proto/converter.lua @@ -39,8 +39,9 @@ local function diffedPackPosition(uri, pos) if col > 0 then local text = files.getOriginText(uri) if text then - local lineOffset = originLines[row] - col = utf8.len(text, lineOffset, lineOffset + col - 1, true) + local lineOffset = originLines[row] + local finalOffset = math.min(lineOffset + col - 1, #text + 1) + col = utf8.len(text, lineOffset, finalOffset, true) end end return { |