From ffc383d45e4a4a21958ec88ae8815c4683d3f2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 10 Nov 2019 23:29:36 +0800 Subject: =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=80=E4=B8=8B=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/proto/define.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server-beta/src/proto') 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, -- cgit v1.2.3