diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-09 00:04:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-09 00:04:16 +0800 |
commit | 4e7cdc47cc0f3b43ff62dee7f7c1b2d58a0e169c (patch) | |
tree | 86087922676fb568ab0fa3134b9fd2fa7dfcc46a /script-beta/proto/define.lua | |
parent | b7e30e823d25f0d31b37eed4ea1cad888f529fbd (diff) | |
download | lua-language-server-4e7cdc47cc0f3b43ff62dee7f7c1b2d58a0e169c.zip |
换算offset时总是使用上一个位置
Diffstat (limited to 'script-beta/proto/define.lua')
-rw-r--r-- | script-beta/proto/define.lua | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/script-beta/proto/define.lua b/script-beta/proto/define.lua index c5002cbf..98a56547 100644 --- a/script-beta/proto/define.lua +++ b/script-beta/proto/define.lua @@ -12,11 +12,7 @@ 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 offset > #text - or text:sub(offset-1, offset):match '[%w_][^%w_]' then - offset = offset - 1 - end - return offset + return offset - 1 end --- 将光标位置转化为 position |