aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/textadept/find.lua3
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