Fixed offsets, and passed through an additional parameter.
This commit is contained in:
parent
88c5424e0b
commit
a100a7b6a9
|
@ -33,9 +33,9 @@ function search.find(doc, line, col, text, opt)
|
|||
for line = line, #doc.lines do
|
||||
local line_text = doc.lines[line]
|
||||
if opt.regex then
|
||||
local s, e = re:match(line_text, col, true)
|
||||
local s, e = re:cmatch(line_text, col, true)
|
||||
if s then
|
||||
return line, s, line, e + 1
|
||||
return line, s, line, e
|
||||
end
|
||||
col = 1
|
||||
else
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
-- pattern:gsub(string).
|
||||
regex.__index = function(table, key) return regex[key]; end
|
||||
|
||||
regex.match = function(pattern_string, string)
|
||||
regex.match = function(pattern_string, string, offset)
|
||||
local pattern = type(pattern_string) == "table" and
|
||||
pattern_string or regex.compile(pattern_string)
|
||||
return regex.cmatch(pattern, string)
|
||||
return regex.cmatch(pattern, string, offset)
|
||||
end
|
||||
|
||||
-- Will iterate back through any UTF-8 bytes so that we don't replace bits
|
||||
|
|
Loading…
Reference in New Issue