[LyX/master] Fix handling of doRemove in advanced search Amend 11c47ddf

Kornel Benko kornel at lyx.org
Wed Jan 1 12:48:09 UTC 2020


commit 49aaf95894efefa80e4c7880e6e48ef1ee5738e4
Author: Kornel Benko <kornel at lyx.org>
Date:   Wed Jan 1 14:03:21 2020 +0100

    Fix handling of doRemove in advanced search
    Amend 11c47ddf
---
 src/lyxfind.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 139e7b3..d45fdd3 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -1911,12 +1911,16 @@ void LatexInfo::buildEntries(bool isPatternString)
           int endpar = 2 + interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
           found._dataStart = endpar;
           found._tokensize = found._dataStart - found._tokenstart;
-          closings = 1;
+          closings = 0;
         }
         if (interval_.par.substr(found._dataStart-1, 15).compare("\\endarguments{}") == 0) {
           found._dataStart += 15;
         }
-        size_t endpos = interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
+        size_t endpos;
+        if (closings < 1)
+          endpos = found._dataStart - 1;
+        else
+          endpos = interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
         if (found.keytype == KeyInfo::isList) {
           // Check if it really is list env
           static regex const listre("^([a-z]+)$");
@@ -2041,9 +2045,9 @@ void LatexInfo::buildKeys(bool isPatternString)
   makeKey("url|href|vref|thanks", KeyInfo(KeyInfo::isStandard, 1, false), isPatternString);
 
   // Ignore deleted text
-  makeKey("lyxdeleted", KeyInfo(KeyInfo::doRemove, 2, false), isPatternString);
+  makeKey("lyxdeleted", KeyInfo(KeyInfo::doRemove, 3, false), isPatternString);
   // but preserve added text
-  makeKey("lyxadded", KeyInfo(KeyInfo::doRemove, 1, false), isPatternString);
+  makeKey("lyxadded", KeyInfo(KeyInfo::doRemove, 2, false), isPatternString);
 
   // Macros to remove, but let the parameter survive
   // No split


More information about the lyx-cvs mailing list