]> git.lyx.org Git - features.git/commitdiff
FindAdv: Correct start of search if not using regex
authorKornel Benko <kornel@lyx.org>
Sat, 16 Mar 2019 10:26:20 +0000 (11:26 +0100)
committerKornel Benko <kornel@lyx.org>
Sat, 16 Mar 2019 10:26:20 +0000 (11:26 +0100)
Do not try to find pattern inside the leading string.

src/lyxfind.cpp

index a6c9f4dd76ef6902dfb9283c71127da2642c3dc1..90d4ca5c21614435bf8ee5f8eab002d896a0286b 100644 (file)
@@ -2923,7 +2923,8 @@ MatchResult MatchStringAdv::findAux(DocIterator const & cur, int len, bool at_be
                        return mres;
                }
        } else {
-               size_t pos = str.find(par_as_string_nolead);
+               // Start the search _after_ the leading part
+               size_t pos = str.find(par_as_string_nolead, lead_as_string.size());
                if (pos != string::npos) {
                        mres.match_len = par_as_string.size();
                        mres.match2end = str.size() - pos;