[LyX/master] FindAdv: Fix the length of leading string

Kornel Benko kornel at lyx.org
Fri Apr 29 16:50:04 UTC 2022


commit 531fed9543b07cb06d23ba8f7276691d8fd6b9d6
Author: Kornel Benko <kornel at lyx.org>
Date:   Fri Apr 29 19:23:50 2022 +0200

    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.
---
 src/lyxfind.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index a4dd810..c0d8640 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -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();
 }
 
 /*


More information about the lyx-cvs mailing list