summaryrefslogtreecommitdiff
path: root/server-beta/src/proto/define.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/proto/define.lua')
-rw-r--r--server-beta/src/proto/define.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/server-beta/src/proto/define.lua b/server-beta/src/proto/define.lua
index 5e6bd3cf..1bf45531 100644
--- a/server-beta/src/proto/define.lua
+++ b/server-beta/src/proto/define.lua
@@ -23,7 +23,13 @@ end
function m.position(lines, text, offset)
local row, col = guide.positionOf(lines, offset)
local start = guide.lineRange(lines, row)
+ if start < 1 then
+ start = 1
+ end
local ucol = utf8.len(text, start, start + col - 1, true)
+ if row < 1 then
+ row = 1
+ end
return {
line = row - 1,
character = ucol,