From: Kornel Benko Date: Mon, 25 Feb 2019 10:59:54 +0000 (+0100) Subject: FindAdv: Fix #11496 -- too slow find X-Git-Tag: lyx-2.4.0dev-acb2ca7b~2551 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e69f70227582bf51d8c9d05d98f216897240be5f;p=lyx.git FindAdv: Fix #11496 -- too slow find Also added some more macros to handle --- diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 033fd4c31c..3d9781e1cb 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -1845,7 +1845,7 @@ void LatexInfo::buildKeys(bool isPatternString) // Skip // makeKey("enskip|smallskip|medskip|bigskip|vfill", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); // Custom space/skip, remove the content (== length value) - makeKey("vspace|hspace|mspace", KeyInfo(KeyInfo::noContent, 1, false), isPatternString); + makeKey("vspace|vspace*|hspace|hspace*|mspace", KeyInfo(KeyInfo::noContent, 1, false), isPatternString); // Found in fr/UserGuide.lyx makeKey("og|fg", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); // quotes @@ -1877,7 +1877,7 @@ void LatexInfo::buildKeys(bool isPatternString) makeKey("trianglerightpar|hexagonpar|starpar", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); makeKey("triangleuppar|triangledownpar|droppar", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); makeKey("triangleleftpar|shapepar|dropuppar", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); - makeKey("hphantom|footnote|shortcut|includegraphics", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); + makeKey("hphantom|vphantom|footnote|shortcut|include|includegraphics", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString); makeKey("parbox", KeyInfo(KeyInfo::doRemove, 1, true), isPatternString); // like ('tiny{}' or '\tiny ' ... ) makeKey("footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge", KeyInfo(KeyInfo::isSize, 0, false), isPatternString); @@ -3120,8 +3120,13 @@ int findForwardAdv(DocIterator & cur, MatchStringAdv & match) } } if (match_len2 >= 0) { - if (match_len2 == 0) - match_len_zero_count++; + if (match_len2 == 0) { + if (match_len_zero_count++ > 10) { + // Omit loooong loops in long paragraphs + LYXERR(Debug::FIND, "match_len2_zero_count: " << match_len_zero_count << ", match_len was " << match_len); + break; + } + } else match_len_zero_count = 0; }