FindAdv: Fix the length of leading string

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.
This commit is contained in:
Kornel Benko 2022-04-29 19:23:50 +02:00
parent a83159f051
commit 531fed9543

View File

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