diff options
author | 2016-02-01 19:47:25 -0500 | |
---|---|---|
committer | 2016-02-01 19:47:25 -0500 | |
commit | de6b2fa8cea2bc2edd84a1db7a715776d237d2a9 (patch) | |
tree | 7df4047e1d6bf612a1d1420a6b06eb8b47661b40 | |
parent | 491a5f0b794c799a1c45971ef92e86488b322b81 (diff) | |
download | textadept-de6b2fa8cea2bc2edd84a1db7a715776d237d2a9.tar.gz textadept-de6b2fa8cea2bc2edd84a1db7a715776d237d2a9.zip |
Do not assume 1 byte char widths in Lua pattern find; modules/textadept/find.lua
Eventually UTF-8 patterns may be possible.
-rw-r--r-- | modules/textadept/find.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index 4c89ce7c..ea6a287e 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -160,7 +160,8 @@ local function find_(text, next, flags, no_wrap, wrapped) local caps = {buffer:text_range(s, e):find(next and patt or '^.*()'..patt)} M.captures = {table.unpack(caps, next and 3 or 4)} if #caps > 0 and caps[2] >= caps[1] then - pos, e = s + caps[next and 1 or 3] - 1, s + caps[2] + pos = buffer:position_relative(s, caps[next and 1 or 3] - 1) + e = buffer:position_relative(s, caps[2]) M.captures[0] = buffer:text_range(pos, e) buffer:set_sel(e, pos) end |