From 012c0f6bacfa1aeaa4bf58c23e1ad1802c967267 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Fri, 14 Aug 2020 21:32:24 +0200 Subject: [PATCH] #6401 avoid unnecessary inset to string conversions in Paragraph::find while skipping invisible letters --- src/Paragraph.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 99ab12967f..92f6ea129b 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++; }