[LyX/master] FindAdv: Ignore '\ensuremath{' while searching

Kornel Benko kornel at lyx.org
Wed Feb 3 11:19:03 UTC 2021


commit 8d17594a3308fd46c0ceb4c2aaf482d5c218d542
Author: Kornel Benko <kornel at lyx.org>
Date:   Wed Feb 3 12:18:33 2021 +0100

    FindAdv: Ignore '\ensuremath{' while searching
    
    but keep contents
    e.g. '\ensuremath{abc}' ==> 'abc'
---
 src/lyxfind.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 93e454f..8b39d8b 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -953,7 +953,7 @@ static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions co
 		}
 		// Even in ignore-format we have to remove "\text{}, \lyxmathsym{}" parts
 		string t = to_utf8(str);
-		while (regex_replace(t, t, "\\\\(text|lyxmathsym)\\{([^\\}]*)\\}", "$2"));
+		while (regex_replace(t, t, "\\\\(text|lyxmathsym|ensuremath)\\{([^\\}]*)\\}", "$2"));
 		str = from_utf8(t);
 	}
 	return str;
@@ -2102,7 +2102,7 @@ void LatexInfo::buildKeys(bool isPatternString)
   if (keysBuilt && !isPatternString) return;
 
   // Keys to ignore in any case
-  makeKey("text|textcyrillic|lyxmathsym", KeyInfo(KeyInfo::headRemove, 1, true), true);
+  makeKey("text|textcyrillic|lyxmathsym|ensuremath", KeyInfo(KeyInfo::headRemove, 1, true), true);
   // Known standard keys with 1 parameter.
   // Split is done, if not at start of region
   makeKey("textsf|textss|texttt", KeyInfo(KeyInfo::isStandard, 1, ignoreFormats.getFamily()), isPatternString);


More information about the lyx-cvs mailing list