[LyX/master] Consider inset strings in simple find/replaceAll (#12049)

Juergen Spitzmueller spitz at lyx.org
Tue Jan 12 15:45:25 UTC 2021


commit c0495279415e88ca013f9ec091b1f68588e2f891
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Jan 12 16:45:32 2021 +0100

    Consider inset strings in simple find/replaceAll (#12049)
---
 src/Paragraph.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 8181b1c..994098d 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -4403,8 +4403,13 @@ int Paragraph::find(docstring const & str, bool cs, bool mw,
 				break;
 			odocstringstream os;
 			inset->toString(os);
-			if (!os.str().empty())
-				break;
+			if (!os.str().empty()) {
+				int const insetstringsize = os.str().length();
+				for (int j = 0; j < insetstringsize && pos < parsize; ++i, ++j) {
+					if (str[i] != os.str()[j])
+						break;
+				}
+			}
 			pos++;
 		}
 		if (cs && str[i] != d->text_[pos])


More information about the lyx-cvs mailing list