mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Re-organize, whitespace.
This commit is contained in:
parent
b8216513d6
commit
ee251c626c
@ -951,15 +951,21 @@ int MatchStringAdv::findAux(DocIterator const & cur, int len, bool at_begin) con
|
|||||||
if (at_begin &&
|
if (at_begin &&
|
||||||
(opt.restr == FindAndReplaceOptions::R_ONLY_MATHS && !cur.inMathed()) )
|
(opt.restr == FindAndReplaceOptions::R_ONLY_MATHS && !cur.inMathed()) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
docstring docstr = stringifyFromForSearch(opt, cur, len);
|
docstring docstr = stringifyFromForSearch(opt, cur, len);
|
||||||
LYXERR(Debug::FIND, "Matching against '" << lyx::to_utf8(docstr) << "'");
|
|
||||||
string str = normalize(docstr, true);
|
string str = normalize(docstr, true);
|
||||||
|
LYXERR(Debug::FIND, "Matching against '" << lyx::to_utf8(docstr) << "'");
|
||||||
LYXERR(Debug::FIND, "After normalization: '" << str << "'");
|
LYXERR(Debug::FIND, "After normalization: '" << str << "'");
|
||||||
if (! use_regexp) {
|
|
||||||
LYXERR(Debug::FIND, "Searching in normal mode: par_as_string='" << par_as_string << "', str='" << str << "'");
|
if (!use_regexp) {
|
||||||
LYXERR(Debug::FIND, "Searching in normal mode: lead_as_string='" << lead_as_string << "', par_as_string_nolead='" << par_as_string_nolead << "'");
|
LYXERR(Debug::FIND, "Searching in normal mode: par_as_string='"
|
||||||
|
<< par_as_string << "', str='" << str << "'");
|
||||||
|
LYXERR(Debug::FIND, "Searching in normal mode: lead_as_string='"
|
||||||
|
<< lead_as_string << "', par_as_string_nolead='"
|
||||||
|
<< par_as_string_nolead << "'");
|
||||||
if (at_begin) {
|
if (at_begin) {
|
||||||
LYXERR(Debug::FIND, "size=" << par_as_string.size() << ", substr='" << str.substr(0, par_as_string.size()) << "'");
|
LYXERR(Debug::FIND, "size=" << par_as_string.size()
|
||||||
|
<< ", substr='" << str.substr(0, par_as_string.size()) << "'");
|
||||||
if (str.substr(0, par_as_string.size()) == par_as_string)
|
if (str.substr(0, par_as_string.size()) == par_as_string)
|
||||||
return par_as_string.size();
|
return par_as_string.size();
|
||||||
} else {
|
} else {
|
||||||
@ -969,20 +975,21 @@ int MatchStringAdv::findAux(DocIterator const & cur, int len, bool at_begin) con
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LYXERR(Debug::FIND, "Searching in regexp mode: at_begin=" << at_begin);
|
LYXERR(Debug::FIND, "Searching in regexp mode: at_begin=" << at_begin);
|
||||||
// Try all possible regexp matches,
|
|
||||||
//until one that verifies the braces match test is found
|
|
||||||
regex const & p_regexp = at_begin ? regexp : regexp2;
|
regex const & p_regexp = at_begin ? regexp : regexp2;
|
||||||
sregex_iterator re_it(str.begin(), str.end(), p_regexp);
|
sregex_iterator re_it(str.begin(), str.end(), p_regexp);
|
||||||
match_results<string::const_iterator> const & m = *re_it;
|
match_results<string::const_iterator> const & m = *re_it;
|
||||||
|
|
||||||
// Check braces on the segment that matched the entire regexp expression,
|
// Check braces on the segment that matched the entire regexp expression,
|
||||||
// plus the last subexpression, if a (.*?) was inserted in the constructor.
|
// plus the last subexpression, if a (.*?) was inserted in the constructor.
|
||||||
if (!braces_match(m[0].first, m[0].second, open_braces))
|
if (!braces_match(m[0].first, m[0].second, open_braces))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Check braces on segments that matched all (.*?) subexpressions,
|
// Check braces on segments that matched all (.*?) subexpressions,
|
||||||
// except the last "padding" one inserted by lyx.
|
// except the last "padding" one inserted by lyx.
|
||||||
for (size_t i = 1; i < m.size() - 1; ++i)
|
for (size_t i = 1; i < m.size() - 1; ++i)
|
||||||
if (!braces_match(m[i].first, m[i].second))
|
if (!braces_match(m[i].first, m[i].second))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Exclude from the returned match length any length
|
// Exclude from the returned match length any length
|
||||||
// due to close wildcards added at end of regexp
|
// due to close wildcards added at end of regexp
|
||||||
if (close_wildcards == 0)
|
if (close_wildcards == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user