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;
} 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);
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;
}
/** 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:
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;
}
} 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();