X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fparagraph_funcs.C;h=18e6855c76fc1ac308fc87834bbd43ee2c4d2b72;hb=498f06d43a0f2000c3f704db1ea39fda3c819fe6;hp=7235db4f182c29538ce5b993dfad772ac9b6c158;hpb=df71b75d4a19b80cd6f1b3359982a1c06fefe4b5;p=lyx.git diff --git a/src/paragraph_funcs.C b/src/paragraph_funcs.C index 7235db4f18..18e6855c76 100644 --- a/src/paragraph_funcs.C +++ b/src/paragraph_funcs.C @@ -11,6 +11,7 @@ #include #include "paragraph_funcs.h" +#include "paragraph_pimpl.h" #include "buffer.h" #include "ParagraphParameters.h" #include "lyxtextclasslist.h" @@ -34,6 +35,9 @@ void breakParagraph(BufferParams const & bparams, // remember to set the inset_owner tmp->setInsetOwner(par->inInset()); + if (bparams.tracking_changes) + tmp->trackChanges(); + // this is an idea for a more userfriendly layout handling, I will // see what the users say @@ -62,22 +66,34 @@ void breakParagraph(BufferParams const & bparams, // copy everything behind the break-position // to the new paragraph + +#ifdef WITH_WARNINGS +#warning this seems wrong +#endif + /* FIXME: if !keepempty, empty() == true, then we reach + * here with size() == 0. So pos_end becomes - 1. Why + * doesn't this cause problems ??? + */ pos_type pos_end = par->size() - 1; pos_type i = pos; pos_type j = pos; + for (; i <= pos_end; ++i) { + Change::Type change(par->lookupChange(i)); par->cutIntoMinibuffer(bparams, i); - if (tmp->insertFromMinibuffer(j - pos)) + if (tmp->insertFromMinibuffer(j - pos)) { + tmp->pimpl_->setChange(j - pos, change); ++j; + } } for (i = pos_end; i >= pos; --i) { - par->erase(i); + par->pimpl_->eraseIntern(i); } } if (pos) return; - + tmp->params().lineTop(par->params().lineTop()); tmp->params().pagebreakTop(par->params().pagebreakTop()); tmp->params().spaceTop(par->params().spaceTop()); @@ -94,6 +110,15 @@ void breakParagraph(BufferParams const & bparams, par->setLabelWidthString(tmp->params().labelWidthString()); par->params().depth(tmp->params().depth()); } + + // subtle, but needed to get empty pars working right + if (bparams.tracking_changes) { + if (!par->size()) { + par->cleanChanges(); + } else if (!tmp->size()) { + tmp->cleanChanges(); + } + } } @@ -125,13 +150,8 @@ void breakParagraphConservative(BufferParams const & bparams, } -// Be carefull, this does not make any check at all. -// This method has wrong name, it combined this par with the next par. -// In that sense it is the reverse of break paragraph. (Lgb) -void pasteParagraph(BufferParams const & bparams, - Paragraph * par) +void mergeParagraph(BufferParams const & bparams, Paragraph * par) { - // copy the next paragraph to this one Paragraph * the_next = par->next(); // first the DTP-stuff