Do not copy deleted text to external clipboard

Fixes #10416
This commit is contained in:
Juergen Spitzmueller 2019-12-31 13:47:06 +01:00
parent affc006bae
commit 11c47ddfcf
3 changed files with 11 additions and 6 deletions

View File

@ -347,7 +347,7 @@ docstring parbreak(CursorData const * cur)
}
docstring CursorData::selectionAsString(bool with_label) const
docstring CursorData::selectionAsString(bool const with_label, bool const skipdelete) const
{
if (!selection())
return docstring();
@ -355,8 +355,12 @@ docstring CursorData::selectionAsString(bool with_label) const
if (inMathed())
return cap::grabSelection(*this);
int const label = with_label
int label = with_label
? AS_STR_LABEL | AS_STR_INSETS : AS_STR_INSETS;
if (skipdelete)
label = with_label
? AS_STR_LABEL | AS_STR_INSETS | AS_STR_SKIPDELETE
: AS_STR_INSETS | AS_STR_SKIPDELETE;
idx_type const startidx = selBegin().idx();
idx_type const endidx = selEnd().idx();

View File

@ -154,7 +154,8 @@ public:
DocIterator selectionEnd() const;
///
docstring selectionAsString(bool with_label) const;
docstring selectionAsString(bool const with_label,
bool const skipdelete = false) const;
/// get some interesting description of top position
void info(odocstream & os, bool devel_mode) const;
///

View File

@ -950,7 +950,7 @@ void cutSelectionHelper(Cursor & cur, CutStack & cuts, bool realcut, bool putcli
// Even if there is no selection.
if (putclip)
putClipboard(cuts[0].first, cuts[0].second,
cur.selectionAsString(true));
cur.selectionAsString(true, true));
}
if (begpit != endpit)
@ -1011,7 +1011,7 @@ void cutSelectionToTemp(Cursor & cur, bool realcut)
void copySelection(Cursor const & cur)
{
copySelection(cur, cur.selectionAsString(true));
copySelection(cur, cur.selectionAsString(true, true));
}
@ -1122,7 +1122,7 @@ void saveSelection(Cursor const & cur)
if (cur.selection()
&& cur.selBegin() == cur.bv().cursor().selBegin()
&& cur.selEnd() == cur.bv().cursor().selEnd()) {
LYXERR(Debug::SELECTION, "saveSelection: '" << cur.selectionAsString(true) << "'");
LYXERR(Debug::SELECTION, "saveSelection: '" << cur.selectionAsString(true, true) << "'");
copySelectionToStack(cur, selectionBuffer);
}
}