From 1f6d6ef0e134659ab55ed0ad5d380676a5983cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 16 Nov 2019 03:05:24 +0800 Subject: =?UTF-8?q?=E7=9F=AB=E6=AD=A3=E5=85=89=E6=A0=87=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/proto/define.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'server-beta/src/proto/define.lua') 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 -- cgit v1.2.3