summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArcanox <arcanox@arcanox.me>2021-09-25 21:04:42 -0500
committerArcanox <arcanox@arcanox.me>2021-09-25 21:04:42 -0500
commit4fb25e5b8da07239e19036e72ef67c11b4509905 (patch)
treeee65186628457ad3423ecb933c6f12528a977387
parent26b94c16676c6e813ffc75aef4efccb4a25145d1 (diff)
downloadlua-language-server-4fb25e5b8da07239e19036e72ef67c11b4509905.zip
Fix another issue in converter that happened in a workspace I'm working in; seems to be when a line is shortened
-rw-r--r--script/proto/converter.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua
index 0cae230e..da0442fe 100644
--- a/script/proto/converter.lua
+++ b/script/proto/converter.lua
@@ -13,7 +13,11 @@ local function rawPackPosition(uri, pos)
if text then
local lineOffset = state.lines[row]
if lineOffset then
- col = utf8.len(text, lineOffset, lineOffset + col - 1, true)
+ local start = lineOffset
+ local finish = lineOffset + col - 1
+ if start <= #text and finish <= #text then
+ col = utf8.len(text, lineOffset, lineOffset + col - 1, true)
+ end
else
col = 0
end