mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Revert "Fixing #7987: deleted text in change-tracking mode is not found in Advanced F&R any more."
This reverts commit cb351665f4
.
This commit is contained in:
parent
ac8b77fc03
commit
53b60462ac
@ -3347,7 +3347,7 @@ docstring Paragraph::asString(int options) const
|
||||
}
|
||||
|
||||
|
||||
docstring Paragraph::asString(pos_type beg, pos_type end, int options, const OutputParams *p_runparams) const
|
||||
docstring Paragraph::asString(pos_type beg, pos_type end, int options) const
|
||||
{
|
||||
odocstringstream os;
|
||||
|
||||
@ -3364,14 +3364,9 @@ docstring Paragraph::asString(pos_type beg, pos_type end, int options, const Out
|
||||
|| (c == '\n' && (options & AS_STR_NEWLINES)))
|
||||
os.put(c);
|
||||
else if (c == META_INSET && (options & AS_STR_INSETS)) {
|
||||
if (options & AS_STR_PLAINTEXT) {
|
||||
LASSERT(p_runparams != 0, return docstring());
|
||||
getInset(i)->plaintext(os, *p_runparams);
|
||||
} else {
|
||||
getInset(i)->toString(os);
|
||||
if (getInset(i)->asInsetMath())
|
||||
os << " ";
|
||||
}
|
||||
getInset(i)->toString(os);
|
||||
if (getInset(i)->asInsetMath())
|
||||
os << " ";
|
||||
}
|
||||
}
|
||||
|
||||
@ -3397,6 +3392,33 @@ void Paragraph::forToc(docstring & os, size_t maxlen) const
|
||||
}
|
||||
|
||||
|
||||
docstring Paragraph::stringify(pos_type beg, pos_type end, int options,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
odocstringstream os;
|
||||
|
||||
if (beg == 0
|
||||
&& options & AS_STR_LABEL
|
||||
&& !d->params_.labelString().empty())
|
||||
os << d->params_.labelString() << ' ';
|
||||
|
||||
OutputParams op = runparams;
|
||||
op.for_search = true;
|
||||
|
||||
for (pos_type i = beg; i < end; ++i) {
|
||||
char_type const c = d->text_[i];
|
||||
if (isPrintable(c) || c == '\t'
|
||||
|| (c == '\n' && (options & AS_STR_NEWLINES)))
|
||||
os.put(c);
|
||||
else if (c == META_INSET && (options & AS_STR_INSETS)) {
|
||||
getInset(i)->plaintext(os, op);
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
void Paragraph::setInsetOwner(Inset const * inset)
|
||||
{
|
||||
d->inset_owner_ = inset;
|
||||
|
@ -127,8 +127,7 @@ enum AsStringParameter
|
||||
AS_STR_LABEL = 1, ///< Prefix with paragraph label.
|
||||
AS_STR_INSETS = 2, ///< Go into insets.
|
||||
AS_STR_NEWLINES = 4, ///< Get also newline characters.
|
||||
AS_STR_SKIPDELETE = 8, ///< Skip deleted text in change tracking.
|
||||
AS_STR_PLAINTEXT = 16 ///< Extract only the explicitly visible text (without any formatting), when descending into insets
|
||||
AS_STR_SKIPDELETE = 8 ///< Skip deleted text in change tracking.
|
||||
};
|
||||
|
||||
|
||||
@ -176,11 +175,15 @@ public:
|
||||
docstring asString(int options = AS_STR_NONE) const;
|
||||
///
|
||||
docstring asString(pos_type beg, pos_type end,
|
||||
int options = AS_STR_NONE,
|
||||
const OutputParams *p_runparams = 0) const;
|
||||
int options = AS_STR_NONE) const;
|
||||
///
|
||||
void forToc(docstring &, size_t maxlen) const;
|
||||
|
||||
/// Extract only the explicitly visible text (without any formatting),
|
||||
/// descending into insets
|
||||
docstring stringify(pos_type beg, pos_type end, int options,
|
||||
OutputParams const & runparams) const;
|
||||
|
||||
///
|
||||
void write(std::ostream &, BufferParams const &,
|
||||
depth_type & depth) const;
|
||||
|
@ -782,17 +782,14 @@ static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions co
|
||||
runparams.flavor = OutputParams::LATEX;
|
||||
runparams.linelen = 100000; //lyxrc.plaintext_linelen;
|
||||
runparams.dryrun = true;
|
||||
runparams.for_search = true;
|
||||
for (pos_type pit = pos_type(0); pit < (pos_type)buffer.paragraphs().size(); ++pit) {
|
||||
Paragraph const & par = buffer.paragraphs().at(pit);
|
||||
LYXERR(Debug::FIND, "Adding to search string: '"
|
||||
<< par.asString(pos_type(0), par.size(),
|
||||
AS_STR_INSETS | AS_STR_SKIPDELETE | AS_STR_PLAINTEXT,
|
||||
&runparams)
|
||||
<< par.stringify(pos_type(0), par.size(),
|
||||
AS_STR_INSETS, runparams)
|
||||
<< "'");
|
||||
str += par.asString(pos_type(0), par.size(),
|
||||
AS_STR_INSETS | AS_STR_SKIPDELETE | AS_STR_PLAINTEXT,
|
||||
&runparams);
|
||||
str += par.stringify(pos_type(0), par.size(),
|
||||
AS_STR_INSETS, runparams);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
@ -1043,9 +1040,7 @@ docstring stringifyFromCursor(DocIterator const & cur, int len)
|
||||
runparams.dryrun = true;
|
||||
LYXERR(Debug::FIND, "Stringifying with cur: "
|
||||
<< cur << ", from pos: " << cur.pos() << ", end: " << end);
|
||||
return par.asString(cur.pos(), end,
|
||||
AS_STR_INSETS | AS_STR_SKIPDELETE | AS_STR_PLAINTEXT,
|
||||
&runparams);
|
||||
return par.stringify(cur.pos(), end, AS_STR_INSETS, runparams);
|
||||
} else if (cur.inMathed()) {
|
||||
docstring s;
|
||||
CursorSlice cs = cur.top();
|
||||
|
Loading…
Reference in New Issue
Block a user