string str = normalize(docstr);
LYXERR(Debug::FIND, "After normalization: '" << str << "'");
if (! opt.regexp) {
+ LYXERR(Debug::FIND, "Searching in normal mode: par_as_string='" << par_as_string << "', str='" << str << "'");
if (at_begin) {
+ 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)
return par_as_string.size();
} else {
- size_t pos = str.find(par_as_string);
+ string t = par_as_string;
+ while (regex_replace(t, t, "\\\\(emph|textbf|subsubsection|subsection|section|subparagraph|paragraph|part)\\{", "")
+ || regex_replace(t, t, "^\\$", "")
+ || regex_replace(t, t, "^\\\\\\[ ", ""))
+ LYXERR(Debug::FIND, " after removing leading $, \[ , \\emph{, \\textbf{, etc.: " << t);
+ size_t pos = str.find(t);
if (pos != string::npos)
return par_as_string.size();
}
} else {
+ LYXERR(Debug::FIND, "Searching in regexp mode");
// Try all possible regexp matches,
//until one that verifies the braces match test is found
regex const *p_regexp = at_begin ? ®exp : ®exp2;
t.replace(pos, 1, " ");
// Remove stale empty \emph{}, \textbf{} and similar blocks from latexify
LYXERR(Debug::FIND, "Removing stale empty \\emph{}, \\textbf{}, \\*section{} macros from: " << t);
- while (regex_replace(t, t, "\\\\(emph|textbf|subsubsection|subsection|section|subparagraph|paragraph)(\\{\\})+", ""))
+ while (regex_replace(t, t, "\\\\(emph|textbf|subsubsection|subsection|section|subparagraph|paragraph|part)(\\{\\})+", ""))
LYXERR(Debug::FIND, " further removing stale empty \\emph{}, \\textbf{} macros from: " << t);
return t;
}
bv->buffer().markDirty();
cur.pos() -= repl_buffer.paragraphs().begin()->size();
bv->putSelectionAt(DocIterator(cur), repl_buffer.paragraphs().begin()->size(), !opt.forward);
+ bv->processUpdateFlags(Update::Force);
}