[LyX/master] #6401 avoid unnecessary inset to string conversions in Paragraph::find while skipping invisible letters

Stephan Witt switt at lyx.org
Fri Aug 14 19:06:44 UTC 2020


commit 012c0f6bacfa1aeaa4bf58c23e1ad1802c967267
Author: Stephan Witt <switt at lyx.org>
Date:   Fri Aug 14 21:32:24 2020 +0200

    #6401 avoid unnecessary inset to string conversions in Paragraph::find while skipping invisible letters
---
 src/Paragraph.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 99ab129..92f6ea1 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -4307,9 +4307,12 @@ 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)) {
+			Inset const * inset = getInset(pos);
+			if (!inset->isLetter())
+				break;
 			odocstringstream os;
-			getInset(pos)->toString(os);
-			if (!getInset(pos)->isLetter() || !os.str().empty())
+			inset->toString(os);
+			if (!os.str().empty())
 				break;
 			pos++;
 		}


More information about the lyx-cvs mailing list