From 9a1a806b60d70aad97afe2a55a7ec14929ee21a8 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Sat, 16 Mar 2019 11:26:20 +0100 Subject: [PATCH] FindAdv: Correct start of search if not using regex Do not try to find pattern inside the leading string. --- src/lyxfind.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index a6c9f4dd76..90d4ca5c21 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -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; -- 2.39.2