From 92db048e7c4bb02967156bc9fcd26744e746b097 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Mon, 25 Oct 2021 00:18:20 +0200 Subject: [PATCH] Use plain search by default in `search.find` --- data/core/doc/search.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/core/doc/search.lua b/data/core/doc/search.lua index b4c553c9..8395769a 100644 --- a/data/core/doc/search.lua +++ b/data/core/doc/search.lua @@ -43,6 +43,7 @@ end function search.find(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 search_func = string.find if opt.regex then @@ -60,9 +61,9 @@ function search.find(doc, line, col, text, opt) end local s, e 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 - s, e = search_func(line_text, pattern, col) + s, e = search_func(line_text, pattern, col, plain) end if s then return line, s, line, e + 1