mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
FindAdv: Simplify search for chars '&', '%', '#' and '_'
This is not possible for '$', because of the latex-meaning to start/end math inset. Therefore, if not ignoring format, we still have to use [\\][\$] in regex in order to find '$' in text.
This commit is contained in:
parent
131f4b92ba
commit
cd94180492
@ -1297,9 +1297,17 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
|
|||||||
column += 14;
|
column += 14;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '$': case '&':
|
case '&':
|
||||||
case '%': case '#': case '{':
|
case '%': case '#':
|
||||||
case '}': case '_':
|
case '_':
|
||||||
|
if (runparams.for_search) {
|
||||||
|
os.put(c);
|
||||||
|
column += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
case '$':
|
||||||
|
case '{': case '}':
|
||||||
os << '\\';
|
os << '\\';
|
||||||
os.put(c);
|
os.put(c);
|
||||||
column += 1;
|
column += 1;
|
||||||
|
@ -74,19 +74,19 @@ void InsetIndex::latex(otexstream & os, OutputParams const & runparams_in) const
|
|||||||
os << '{';
|
os << '{';
|
||||||
}
|
}
|
||||||
|
|
||||||
odocstringstream ourplain;
|
odocstringstream ourlatex;
|
||||||
InsetText::plaintext(ourplain, runparams);
|
otexstream ots(ourlatex);
|
||||||
|
InsetText::latex(ots, runparams);
|
||||||
if (runparams.for_search) {
|
if (runparams.for_search) {
|
||||||
// No need for special handling, if we are only searching for some patterns
|
// No need for special handling, if we are only searching for some patterns
|
||||||
os << ourplain.str() << "}";
|
os << ourlatex.str() << "}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// get contents of InsetText as LaTeX and plaintext
|
// get contents of InsetText as LaTeX and plaintext
|
||||||
odocstringstream ourlatex;
|
odocstringstream ourplain;
|
||||||
|
InsetText::plaintext(ourplain, runparams);
|
||||||
// FIXME: do Tex/Row correspondence (I don't currently understand what is
|
// FIXME: do Tex/Row correspondence (I don't currently understand what is
|
||||||
// being generated from latexstr below)
|
// being generated from latexstr below)
|
||||||
otexstream ots(ourlatex);
|
|
||||||
InsetText::latex(ots, runparams);
|
|
||||||
docstring latexstr = ourlatex.str();
|
docstring latexstr = ourlatex.str();
|
||||||
docstring plainstr = ourplain.str();
|
docstring plainstr = ourplain.str();
|
||||||
|
|
||||||
|
@ -1442,8 +1442,16 @@ void LatexInfo::buildEntries(bool isPatternString)
|
|||||||
if (key == "") {
|
if (key == "") {
|
||||||
if (sub.str(0)[0] == '\\')
|
if (sub.str(0)[0] == '\\')
|
||||||
key = sub.str(0)[1];
|
key = sub.str(0)[1];
|
||||||
else
|
else {
|
||||||
key = sub.str(0);
|
key = sub.str(0);
|
||||||
|
if (key == "$") {
|
||||||
|
size_t k_pos = sub.position(size_t(0));
|
||||||
|
if ((k_pos > 0) && (interval.par[k_pos - 1] == '\\')) {
|
||||||
|
// Escaped '$', ignoring
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (evaluatingRegexp) {
|
if (evaluatingRegexp) {
|
||||||
if (sub.str(1).compare("endregexp") == 0) {
|
if (sub.str(1).compare("endregexp") == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user