diff options
| author | Adam <adamdharrison@gmail.com> | 2021-10-31 13:55:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-31 13:55:30 -0400 |
| commit | 920982cbe7a098cf0056b30654d99d8398f561de (patch) | |
| tree | ccced3ac040d3bc69e9595448d34649dc5d23ce9 | |
| parent | e68d6016f89a2e65846c2a1ac60179f849cdb5c3 (diff) | |
| parent | 92db048e7c4bb02967156bc9fcd26744e746b097 (diff) | |
| download | lite-xl-920982cbe7a098cf0056b30654d99d8398f561de.tar.gz lite-xl-920982cbe7a098cf0056b30654d99d8398f561de.zip | |
Merge pull request #629 from Guldoman/avoid_patterns_search
Use plain search by default in `search.find`
| -rw-r--r-- | data/core/doc/search.lua | 5 |
1 files 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 |
