From: Kornel Benko Date: Mon, 1 Apr 2013 08:16:45 +0000 (+0200) Subject: Advanced search: Allow faster searching for normal (non-regular) strings X-Git-Tag: 2.1.0beta1~441 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=415343d19b59efdd155f169a7dd4fe7ab9929720;p=lyx.git 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. --- 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);