diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index cc0a765791..8a634a6b0c 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1132,8 +1132,16 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, if (style.pass_thru || runparams.pass_thru || runparams.for_search || contains(style.pass_thru_chars, c) || contains(runparams.pass_thru_chars, c)) { - if ((c == '\\') && runparams.for_search) - os << "\\\\"; + if (runparams.for_search) { + if (c == '\\') + os << "\\\\"; + else if (c == '{') + os << "\\braceleft"; + else if (c == '}') + os << "\\braceright"; + else if (c != '\0') + os.put(c); + } else if (c != '\0') { Encoding const * const enc = runparams.encoding; if (enc && !enc->encodable(c)) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 48006c2534..0e394d3f9a 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -778,6 +778,10 @@ string correctRegex(string t) replace = "\\"; else if (sub.str(4) == "mathcircumflex") replace = "^"; + else if (sub.str(3) == "{") + replace = "\\braceleft"; + else if (sub.str(3) == "}") + replace = "\\braceright"; else replace = sub.str(3); } @@ -2238,6 +2242,7 @@ void LatexInfo::buildKeys(bool isPatternString) // Known charaters // No split makeKey("backslash|textbackslash|slash", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); + makeKey("braceleft|braceright", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); makeKey("textasciicircum|textasciitilde", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); makeKey("textasciiacute|texemdash", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); makeKey("dots|ldots", KeyInfo(KeyInfo::isChar, 0, false), isPatternString); @@ -2931,6 +2936,7 @@ static string correctlanguagesetting(string par, bool isPatternString, bool with return ""; } } + } else { // LYXERR(Debug::INFO, "No regex formats"); @@ -3316,7 +3322,7 @@ MatchResult MatchStringAdv::findAux(DocIterator const & cur, int len, bool at_be int matchend = match.capturedEnd(0); while (mres.match_len > 0) { QChar c = qstr.at(matchend - 1); - if ((c == '\n') || (c == '}') || (c == '{')) { + if (c == '\n') { mres.match_len--; matchend--; }