From: Kornel Benko Date: Wed, 3 Feb 2021 11:18:33 +0000 (+0100) Subject: FindAdv: Ignore '\ensuremath{' while searching X-Git-Tag: 2.4.0-alpha3~137 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8d17594a3308fd46c0ceb4c2aaf482d5c218d542;p=lyx.git FindAdv: Ignore '\ensuremath{' while searching but keep contents e.g. '\ensuremath{abc}' ==> 'abc' --- diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 93e454fcf1..8b39d8b68a 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);