mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Fix searching bug #6139.
Patch by Tommaso. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31053 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fb6e08ec98
commit
ab36804b6c
@ -119,7 +119,6 @@ void FindAndReplaceWidget::findAndReplace(
|
|||||||
searchString += it->stringify(pos_type(0), it->size(), AS_STR_INSETS, runparams);
|
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()) {
|
if (to_utf8(searchString).empty()) {
|
||||||
buffer.message(_("Nothing to search"));
|
buffer.message(_("Nothing to search"));
|
||||||
return;
|
return;
|
||||||
@ -132,6 +131,16 @@ void FindAndReplaceWidget::findAndReplace(
|
|||||||
} else {
|
} else {
|
||||||
replaceString = from_utf8(LYX_FR_NULL_STRING);
|
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,
|
FindAndReplaceOptions opt(searchString, casesensitive, matchword, ! backwards,
|
||||||
expandmacros, ignoreformat, regexp, replaceString);
|
expandmacros, ignoreformat, regexp, replaceString);
|
||||||
LYXERR(Debug::DEBUG, "Dispatching LFUN_WORD_FINDADV" << std::endl);
|
LYXERR(Debug::DEBUG, "Dispatching LFUN_WORD_FINDADV" << std::endl);
|
||||||
|
@ -507,7 +507,7 @@ size_t find_matching_brace(string const & s, size_t pos)
|
|||||||
return s.size();
|
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)
|
string escape_for_regex(string s)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
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.
|
/** 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 {
|
class MatchStringAdv {
|
||||||
public:
|
public:
|
||||||
@ -768,8 +765,9 @@ string MatchStringAdv::normalize(docstring const & s) const
|
|||||||
while ((pos = t.find("\n")) != string::npos)
|
while ((pos = t.find("\n")) != string::npos)
|
||||||
t.replace(pos, 1, " ");
|
t.replace(pos, 1, " ");
|
||||||
// Remove stale empty \emph{}, \textbf{} and similar blocks from latexify
|
// 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;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1671,8 +1671,11 @@ int InsetMathHull::plaintext(odocstream & os, OutputParams const & runparams) co
|
|||||||
} else {
|
} else {
|
||||||
odocstringstream oss;
|
odocstringstream oss;
|
||||||
WriteStream wi(oss, false, true, WriteStream::wsDefault, runparams.encoding);
|
WriteStream wi(oss, false, true, WriteStream::wsDefault, runparams.encoding);
|
||||||
|
// Fix Bug #6139
|
||||||
|
if (type_ == hullRegexp)
|
||||||
|
write(wi);
|
||||||
|
else
|
||||||
wi << cell(0);
|
wi << cell(0);
|
||||||
|
|
||||||
docstring const str = oss.str();
|
docstring const str = oss.str();
|
||||||
os << str;
|
os << str;
|
||||||
return str.size();
|
return str.size();
|
||||||
|
Loading…
Reference in New Issue
Block a user