summaryrefslogtreecommitdiff
path: root/script-beta/proto/define.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/proto/define.lua')
-rw-r--r--script-beta/proto/define.lua6
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