summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server-beta/src/proto/define.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/server-beta/src/proto/define.lua b/server-beta/src/proto/define.lua
index 3771c726..a6ad7e47 100644
--- a/server-beta/src/proto/define.lua
+++ b/server-beta/src/proto/define.lua
@@ -11,6 +11,9 @@ function m.offset(lines, text, position)
local row = position.line + 1
local start = guide.lineRange(lines, row)
local offset = utf8.offset(text, position.character + 1, start)
+ if text:sub(offset-1, offset):match '[%w_][^%w_]' then
+ offset = offset - 1
+ end
return offset
end