[LyX/master] Simple Search: find isChar() insets (#11462)

Juergen Spitzmueller spitz at lyx.org
Wed Jan 13 07:19:47 UTC 2021


commit 22efd5a5efc4ef53bcf9fc65ccd4d372b7365ac6
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Jan 13 08:19:54 2021 +0100

    Simple Search: find isChar() insets (#11462)
---
 src/Paragraph.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 994098d..d954e1e 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -4397,21 +4397,26 @@ int Paragraph::find(docstring const & str, bool cs, bool mw,
 		}
 		// Ignore "invisible" letters such as ligature breaks
 		// and hyphenation chars while searching
-		while (pos < parsize - 1 && isInset(pos)) {
+		bool nonmatch = false;
+		while (pos < parsize && isInset(pos)) {
 			Inset const * inset = getInset(pos);
-			if (!inset->isLetter())
+			if (!inset->isLetter() && !inset->isChar())
 				break;
 			odocstringstream os;
 			inset->toString(os);
 			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])
+					if (str[i] != os.str()[j]) {
+						nonmatch = true;
 						break;
+					}
 				}
 			}
 			pos++;
 		}
+		if (nonmatch || i == strsize)
+			break;
 		if (cs && str[i] != d->text_[pos])
 			break;
 		if (!cs && uppercase(str[i]) != uppercase(d->text_[pos]))


More information about the lyx-cvs mailing list