]> git.lyx.org Git - features.git/commitdiff
Advanced search: Allow faster searching for normal (non-regular) strings
authorKornel Benko <kornel@lyx.org>
Mon, 1 Apr 2013 08:16:45 +0000 (10:16 +0200)
committerKornel Benko <kornel@lyx.org>
Mon, 1 Apr 2013 08:16:45 +0000 (10:16 +0200)
Setting variable 'par_as_string_nolead' also in case we are ignoring format,
drastically accelerates the search.

src/lyxfind.cpp

index d6df0ef78009aef22a93fb10631d08415fc74da7..e74401693d87650b5ac47b4abed8a60fa8280338 100644 (file)
@@ -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);