-
-#ifndef NEW_INSETS
- if (pos > (*par)->Last())
- pos = (*par)->Last();
-#else
- if (pos > (*par)->size())
- pos = (*par)->size();
-#endif
-
- LyXParagraph * tmpbuf;
- LyXParagraph * tmppar = *par;
- int tmppos = pos;
-
- // There are two cases: cutbuffer only one paragraph or many
-#ifndef NEW_INSETS
- if (!buf->next_) {
-#else
- if (!buf->next()) {
-#endif
- // only within a paragraph
- tmpbuf = buf->Clone();
- // Some provisions should be done here for checking
- // if we are inserting at the beginning of a
- // paragraph. If there are a space at the beginning
- // of the text to insert and we are inserting at
- // the beginning of the paragraph the space should
- // be removed.
- while (buf->size()) {
- // This is an attempt to fix the
- // "never insert a space at the
- // beginning of a paragraph" problem.
- if (!tmppos && buf->IsLineSeparator(0)) {
- buf->Erase(0);
- } else {
- buf->CutIntoMinibuffer(current_view->buffer()->params, 0);
- buf->Erase(0);
- if (tmppar->InsertFromMinibuffer(tmppos))
- ++tmppos;
- }
- }
- delete buf;
- buf = tmpbuf;
- *endpar = tmppar->next();
- pos = tmppos;
- } else {
- // many paragraphs
-
- // make a copy of the simple cut_buffer
- tmpbuf = buf;
- LyXParagraph * simple_cut_clone = tmpbuf->Clone();
- LyXParagraph * tmpbuf2 = simple_cut_clone;
-#ifndef NEW_INSETS
- if ((*par)->footnoteflag) {
- tmpbuf->footnoteflag = (*par)->footnoteflag;
- tmpbuf->footnotekind = (*par)->footnotekind;
- }
- while (tmpbuf->next_) {
- tmpbuf = tmpbuf->next_;
- tmpbuf2->next(tmpbuf->Clone());
- tmpbuf2->next_->previous(tmpbuf2);
- tmpbuf2 = tmpbuf2->next_;
- if ((*par)->footnoteflag){
- tmpbuf->footnoteflag = (*par)->footnoteflag;
- tmpbuf->footnotekind = (*par)->footnotekind;
- }
- }
-#else
- while (tmpbuf->next()) {
- tmpbuf = tmpbuf->next();
- tmpbuf2->next(tmpbuf->Clone());
- tmpbuf2->next()->previous(tmpbuf2);
- tmpbuf2 = tmpbuf2->next();
- }
-#endif