From 415343d19b59efdd155f169a7dd4fe7ab9929720 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Mon, 1 Apr 2013 10:16:45 +0200 Subject: [PATCH] Advanced search: Allow faster searching for normal (non-regular) strings Setting variable 'par_as_string_nolead' also in case we are ignoring format, drastically accelerates the search. --- src/lyxfind.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index d6df0ef780..e74401693d 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -841,7 +841,16 @@ MatchStringAdv::MatchStringAdv(lyx::Buffer & buf, FindAndReplaceOptions const & close_wildcards = 0; size_t lead_size = 0; - if (!opt.ignoreformat) { + if (opt.ignoreformat) { + if (!use_regexp) { + // if par_as_string_nolead were emty, + // the following call to findAux will always *find* the string + // in the checked data, and thus always using the slow + // examining of the current text part. + par_as_string_nolead = par_as_string; + } + } + else { lead_size = identifyLeading(par_as_string); lead_as_string = par_as_string.substr(0, lead_size); par_as_string_nolead = par_as_string.substr(lead_size, par_as_string.size() - lead_size); -- 2.39.5