summaryrefslogtreecommitdiff
path: root/script-beta/proto/define.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-13 19:26:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-13 19:26:28 +0800
commit3913f3beba3196119c2ae9c483a97637eee2fe5e (patch)
tree757707d19d1e31ad713411c6c41b3fe492128de0 /script-beta/proto/define.lua
parentb22099c12e001bf81a6d1cf47655e6e815d04391 (diff)
downloadlua-language-server-3913f3beba3196119c2ae9c483a97637eee2fe5e.zip
一些整理
Diffstat (limited to 'script-beta/proto/define.lua')
-rw-r--r--script-beta/proto/define.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/script-beta/proto/define.lua b/script-beta/proto/define.lua
index 317eda6c..0dd781c1 100644
--- a/script-beta/proto/define.lua
+++ b/script-beta/proto/define.lua
@@ -23,7 +23,8 @@ end
function m.offsetOfWord(lines, text, position)
local row = position.line + 1
local start = guide.lineRange(lines, row)
- local offset = utf8.offset(text, position.character + 1, start) if offset > #text
+ local offset = utf8.offset(text, position.character + 1, start)
+ if offset > #text
or text:sub(offset-1, offset):match '[%w_][^%w_]' then
offset = offset - 1
end
@@ -42,7 +43,7 @@ function m.position(lines, text, offset)
if start < 1 then
start = 1
end
- local ucol = util.utf8Len(text, start, start + col - 1, true)
+ local ucol = util.utf8Len(text, start, start + col - 1)
if row < 1 then
row = 1
end