]> git.lyx.org Git - lyx.git/commitdiff
Simple Search: find isChar() insets (#11462)
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 13 Jan 2021 07:19:54 +0000 (08:19 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 13 Jan 2021 07:19:54 +0000 (08:19 +0100)
src/Paragraph.cpp

index 994098df484582bb48e876138917566a2bf2ac11..d954e1e5a52beef55af6c83fdf422a96af495750 100644 (file)
@@ -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]))