mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Do not paste deleted text with CT on (#12900)
This commit is contained in:
parent
68556fab3c
commit
ed9e7d41f5
@ -109,6 +109,21 @@ struct PasteReturnValue {
|
||||
bool needupdate;
|
||||
};
|
||||
|
||||
|
||||
/// return true if the whole ParagraphList is deleted
|
||||
static bool isFullyDeleted(ParagraphList const & pars)
|
||||
{
|
||||
pit_type const pars_size = static_cast<pit_type>(pars.size());
|
||||
|
||||
// check all paragraphs
|
||||
for (pit_type pit = 0; pit < pars_size; ++pit) {
|
||||
if (!pars[pit].empty()) // prevent assertion failure
|
||||
if (!pars[pit].isDeleted(0, pars[pit].size()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
PasteReturnValue
|
||||
pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist,
|
||||
DocumentClassConstPtr oldDocClass, cap::BranchAction branchAction,
|
||||
@ -279,12 +294,20 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist,
|
||||
}
|
||||
|
||||
if (lyxrc.ct_markup_copied) {
|
||||
// Only change to inserted if ct is active,
|
||||
// Only remove deleted text and change
|
||||
// the rest to inserted if ct is active,
|
||||
// otherwise leave markup as is
|
||||
if (buffer.params().track_changes)
|
||||
if (buffer.params().track_changes) {
|
||||
if (!isFullyDeleted(insertion))
|
||||
tmpbuf->acceptChanges(0, tmpbuf->size());
|
||||
else
|
||||
tmpbuf->rejectChanges(0, tmpbuf->size());
|
||||
tmpbuf->setChange(Change(Change::INSERTED));
|
||||
}
|
||||
} else
|
||||
// Resolve all markup to inserted or unchanged
|
||||
// Deleted text has already been removed on copy
|
||||
// (copySelectionHelper)
|
||||
tmpbuf->setChange(Change(buffer.params().track_changes ?
|
||||
Change::INSERTED : Change::UNCHANGED));
|
||||
}
|
||||
@ -667,21 +690,6 @@ void putClipboard(ParagraphList const & paragraphs,
|
||||
}
|
||||
|
||||
|
||||
/// return true if the whole ParagraphList is deleted
|
||||
static bool isFullyDeleted(ParagraphList const & pars)
|
||||
{
|
||||
pit_type const pars_size = static_cast<pit_type>(pars.size());
|
||||
|
||||
// check all paragraphs
|
||||
for (pit_type pit = 0; pit < pars_size; ++pit) {
|
||||
if (!pars[pit].empty()) // prevent assertion failure
|
||||
if (!pars[pit].isDeleted(0, pars[pit].size()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void copySelectionHelper(Buffer const & buf, Text const & text,
|
||||
pit_type startpit, pit_type endpit,
|
||||
int start, int end, DocumentClassConstPtr dc, CutStack & cutstack)
|
||||
|
Loading…
Reference in New Issue
Block a user