]> git.lyx.org Git - features.git/commitdiff
FindAdv: Fix the length of leading string
authorKornel Benko <kornel@lyx.org>
Fri, 29 Apr 2022 17:23:50 +0000 (19:23 +0200)
committerKornel Benko <kornel@lyx.org>
Fri, 29 Apr 2022 17:23:50 +0000 (19:23 +0200)
We are removing leading values from the start of string, so
the size of removed data was wrong because s.find() could find
a position inside the leading part.

src/lyxfind.cpp

index a4dd810e35d95ee48d9875ea28c219a803e4cea3..c0d86409f9c3987ea81e0ed4f7822dc6522f6484 100644 (file)
@@ -1091,7 +1091,7 @@ void MatchStringAdv::FillResults(MatchResult &found_mr)
 static void setFindParams(OutputParams &runparams)
 {
        runparams.flavor = Flavor::XeTeX;
-       runparams.use_polyglossia = true;
+       //runparams.use_polyglossia = true;
        runparams.linelen = 10000; //lyxrc.plaintext_linelen;
        // No side effect of file copying and image conversion
        runparams.dryrun = true;
@@ -1226,7 +1226,7 @@ static size_t identifyLeading(string const & s)
               || regex_replace(t, t, "^\\\\begin\\{[a-zA-Z_]*\\*?\\}", ""))
               ;
        LYXERR(Debug::FINDVERBOSE, "  after removing leading $, \\[ , \\emph{, \\textbf{, etc.: '" << t << "'");
-       return s.find(t);
+       return s.size() - t.size();
 }
 
 /*