mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
FindAdv: Handle search for '{' and '}'
In format-search the chars '{' and '}' are understood as latex parentheses, which normally are not part of text and are discarded. Instead we fake them as if they were a char like \backslash or \guilemotright or such.
This commit is contained in:
parent
a4e6f0dead
commit
ec387b6d65
@ -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))
|
||||
|
@ -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--;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user