diff --git a/src/frontends/qt4/FindAndReplace.cpp b/src/frontends/qt4/FindAndReplace.cpp index 500514a558..9c8bf1e12e 100644 --- a/src/frontends/qt4/FindAndReplace.cpp +++ b/src/frontends/qt4/FindAndReplace.cpp @@ -119,7 +119,6 @@ void FindAndReplaceWidget::findAndReplace( searchString += it->stringify(pos_type(0), it->size(), AS_STR_INSETS, runparams); } } -// lyxerr << "Searching for '" << to_utf8(searchString) << "'" << std::endl; if (to_utf8(searchString).empty()) { buffer.message(_("Nothing to search")); return; @@ -132,6 +131,16 @@ void FindAndReplaceWidget::findAndReplace( } else { replaceString = from_utf8(LYX_FR_NULL_STRING); } + LYXERR(Debug::DEBUG, "FindAndReplaceOptions: " + << "searchstring=" << searchString + << ", casesensitiv=" << casesensitive + << ", matchword=" << matchword + << ", backwards=" << backwards + << ", expandmacros=" << expandmacros + << ", ignoreformat=" << ignoreformat + << ", regexp=" << regexp + << ", replaceString" << replaceString + << std::endl); FindAndReplaceOptions opt(searchString, casesensitive, matchword, ! backwards, expandmacros, ignoreformat, regexp, replaceString); LYXERR(Debug::DEBUG, "Dispatching LFUN_WORD_FINDADV" << std::endl); diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 1002a01d09..750eb90d8a 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -507,7 +507,7 @@ size_t find_matching_brace(string const & s, size_t pos) return s.size(); } -/// Within \regex{} apply get_regex_escapes(), while outside apply get_lyx_unescapes(). +/// Within \regexp{} apply get_regex_escapes(), while outside apply get_lyx_unescapes(). string escape_for_regex(string s) { size_t pos = 0; @@ -596,9 +596,6 @@ bool braces_match(string::const_iterator const & beg, } /** The class performing a match between a position in the document and the FindAdvOptions. - ** - ** @todo The user-entered regexp expression(s) should be enclosed within something like \regexp{}, - ** to be written by a dedicated Inset, so to avoid escaping it in escape_for_regex(). **/ class MatchStringAdv { public: @@ -768,8 +765,9 @@ string MatchStringAdv::normalize(docstring const & s) const while ((pos = t.find("\n")) != string::npos) t.replace(pos, 1, " "); // Remove stale empty \emph{}, \textbf{} and similar blocks from latexify - while (regex_replace(t, t, "\\\\[a-zA-Z_]+(\\{\\})+", "")) - ; + LYXERR(Debug::DEBUG, "Removing stale empty \emph{}, \textbf{} macros from: " << t); + while (regex_replace(t, t, "\\\\(emph|textbf)(\\{\\})+", "")) + LYXERR(Debug::DEBUG, " further removing stale empty \emph{}, \textbf{} macros from: " << t); return t; } diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index d22203816f..8b85e064fc 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1671,8 +1671,11 @@ int InsetMathHull::plaintext(odocstream & os, OutputParams const & runparams) co } else { odocstringstream oss; WriteStream wi(oss, false, true, WriteStream::wsDefault, runparams.encoding); - wi << cell(0); - + // Fix Bug #6139 + if (type_ == hullRegexp) + write(wi); + else + wi << cell(0); docstring const str = oss.str(); os << str; return str.size();