X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCutAndPaste.C;h=c2ddae5c60dfcd7720ca3933fb553b34cf921502;hb=28902af06012253c7b5eb80e179a352aac17d6a5;hp=41aa5ac3b90cf7313bd18591a672795818124415;hpb=d161c23a1c343ec50a232cc8d629e453581913d2;p=lyx.git diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 41aa5ac3b9..c2ddae5c60 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -6,6 +6,7 @@ * \author Jürgen Vigna * \author Lars Gullik Bjønnes * \author Alfredo Braunstein + * \author Michael Gerz * * Full author contact details are available in file CREDITS. */ @@ -209,8 +210,8 @@ pasteSelectionHelper(LCursor & cur, ParagraphList const & parlist, ParIterator fend = par_iterator_end(in); for (; fpit != fend; ++fpit) { - InsetList::iterator lit = fpit->insetlist.begin(); - InsetList::iterator eit = fpit->insetlist.end(); + InsetList::const_iterator lit = fpit->insetlist.begin(); + InsetList::const_iterator eit = fpit->insetlist.end(); for (; lit != eit; ++lit) { switch (lit->inset->lyxCode()) { @@ -292,18 +293,16 @@ PitPosPair eraseSelectionHelper(BufferParams const & params, return PitPosPair(endpit, endpos); } - // A paragraph break has to be physically removed by merging, but - // only if either (1) change tracking is off, or (2) the para break - // is "blue" for (pit_type pit = startpit; pit != endpit + 1;) { - // FIXME: Change tracking (MG) - bool const merge = !params.trackChanges || - pars[pit].isInserted(pars[pit].size()); pos_type const left = (pit == startpit ? startpos : 0); pos_type const right = (pit == endpit ? endpos : pars[pit].size() + 1); - // Logical erase only: - pars[pit].eraseChars(left, right, false); - // Separate handling of para break: + + bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges); + + // Logically erase only, including the end-of-paragraph character + pars[pit].eraseChars(left, right, params.trackChanges); + + // Separate handling of paragraph break: if (merge && pit != endpit && (pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) { pos_type const thissize = pars[pit].size();