Merge pull request #629 from Guldoman/avoid_patterns_search
Use plain search by default in `search.find`
This commit is contained in:
commit
920982cbe7
|
@ -43,6 +43,7 @@ end
|
||||||
|
|
||||||
function search.find(doc, line, col, text, opt)
|
function search.find(doc, line, col, text, opt)
|
||||||
doc, line, col, text, opt = init_args(doc, line, col, text, opt)
|
doc, line, col, text, opt = init_args(doc, line, col, text, opt)
|
||||||
|
local plain = not opt.pattern
|
||||||
local pattern = text
|
local pattern = text
|
||||||
local search_func = string.find
|
local search_func = string.find
|
||||||
if opt.regex then
|
if opt.regex then
|
||||||
|
@ -60,9 +61,9 @@ function search.find(doc, line, col, text, opt)
|
||||||
end
|
end
|
||||||
local s, e
|
local s, e
|
||||||
if opt.reverse then
|
if opt.reverse then
|
||||||
s, e = rfind(search_func, line_text, pattern, col - 1)
|
s, e = rfind(search_func, line_text, pattern, col - 1, plain)
|
||||||
else
|
else
|
||||||
s, e = search_func(line_text, pattern, col)
|
s, e = search_func(line_text, pattern, col, plain)
|
||||||
end
|
end
|
||||||
if s then
|
if s then
|
||||||
return line, s, line, e + 1
|
return line, s, line, e + 1
|
||||||
|
|
Loading…
Reference in New Issue