X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftext2.C;h=d0e6bd231e73aa04da8d46e2305bf204da596d49;hb=eb6a0ad551e44d23f9bc3a346e3484b2f89720ef;hp=2b58afa397163f2c9c5d2ecd5e6fed9259671fa7;hpb=02e190002b602dedb521a22bae961de358751820;p=lyx.git diff --git a/src/text2.C b/src/text2.C index 2b58afa397..d0e6bd231e 100644 --- a/src/text2.C +++ b/src/text2.C @@ -17,19 +17,11 @@ #include "lyxtext.h" #include "LString.h" #include "paragraph.h" -#include "insets/inseterror.h" -#include "insets/insetbib.h" -#include "insets/insetspecialchar.h" -#include "insets/insettext.h" -#include "insets/insetfloat.h" -#include "layout.h" +#include "lyxtextclasslist.h" #include "LyXView.h" -#include "support/textutils.h" -#include "support/lstrings.h" #include "undo_funcs.h" #include "buffer.h" #include "bufferparams.h" -#include "lyx_gui_misc.h" #include "gettext.h" #include "BufferView.h" #include "LyXView.h" @@ -38,16 +30,28 @@ #include "font.h" #include "debug.h" #include "lyxrc.h" +#include "lyxrow.h" #include "FloatList.h" #include "language.h" #include "ParagraphParameters.h" + +#include "insets/inseterror.h" +#include "insets/insetbib.h" +#include "insets/insetspecialchar.h" +#include "insets/insettext.h" +#include "insets/insetfloat.h" + #include "support/LAssert.h" +#include "support/textutils.h" +#include "support/lstrings.h" +using std::vector; using std::copy; using std::find; using std::endl; using std::find; using std::pair; +using lyx::pos_type; LyXText::LyXText(BufferView * bv) @@ -155,7 +159,7 @@ LyXFont const realizeFont(LyXFont const & font, // If position is -1, we get the layout font of the paragraph. // If position is -2, we get the font of the manual label of the paragraph. LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { lyx::Assert(pos >= 0); @@ -167,9 +171,10 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, if (!par_depth) { if (layout.labeltype == LABEL_MANUAL && pos < beginningOfMainBody(buf, par)) { - // 1% goes here - LyXFont f = par->getFontSettings(buf->params, - pos); + // 1% goes here + LyXFont f = par->getFontSettings(buf->params, pos); + if (par->inInset()) + par->inInset()->getDrawFont(f); #ifndef INHERIT_LANGUAGE return f.realize(layout.reslabelfont); #else @@ -177,6 +182,8 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, #endif } else { LyXFont f = par->getFontSettings(buf->params, pos); + if (par->inInset()) + par->inInset()->getDrawFont(f); #ifndef INHERIT_LANGUAGE return f.realize(layout.resfont); #else @@ -203,6 +210,8 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, #else tmpfont.realize(layoutfont, buf->params.language); #endif + if (par->inInset()) + par->inInset()->getDrawFont(tmpfont); return realizeFont(tmpfont, buf, par); } @@ -239,7 +248,7 @@ LyXFont const LyXText::getLabelFont(Buffer const * buf, Paragraph * par) const void LyXText::setCharFont(BufferView * bv, Paragraph * par, - Paragraph::size_type pos, LyXFont const & fnt, + pos_type pos, LyXFont const & fnt, bool toggleall) { Buffer const * buf = bv->buffer(); @@ -268,7 +277,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par, layoutfont = layout.font; // Realize against environment font information - if (par->getDepth()){ + if (par->getDepth()) { Paragraph * tp = par; while (!layoutfont.resolved() && tp && tp->getDepth()) { tp = tp->outerHook(); @@ -301,7 +310,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par, void LyXText::setCharFont(Buffer const * buf, Paragraph * par, - Paragraph::size_type pos, LyXFont const & fnt) + pos_type pos, LyXFont const & fnt) { LyXFont font(fnt); @@ -318,7 +327,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par, layoutfont = layout.font; // Realize against environment font information - if (par->getDepth()){ + if (par->getDepth()) { Paragraph * tp = par; while (!layoutfont.resolved() && tp && tp->getDepth()) { tp = tp->outerHook(); @@ -353,7 +362,7 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par, // inserts a new row behind the specified row, increments // the touched counters void LyXText::insertRow(Row * row, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { Row * tmprow = new Row; if (!row) { @@ -385,16 +394,24 @@ void LyXText::insertRow(Row * row, Paragraph * par, // removes the row and reset the touched counters void LyXText::removeRow(Row * row) const { + Row * row_prev = row->previous(); if (row->next()) - row->next()->previous(row->previous()); - if (!row->previous()) { + row->next()->previous(row_prev); + if (!row_prev) { firstrow = row->next(); +// lyx::Assert(firstrow); } else { - row->previous()->next(row->next()); + row_prev->next(row->next()); } - if (row == lastrow) - lastrow = row->previous(); - + if (row == lastrow) { + lyx::Assert(!row->next()); + lastrow = row_prev; + } + if (refresh_row == row) { + refresh_row = row_prev ? row_prev : row->next(); + // what about refresh_y, refresh_height + } + height -= row->height(); // the text becomes smaller delete row; @@ -453,8 +470,16 @@ Inset * LyXText::getInset() const void LyXText::toggleInset(BufferView * bview) { Inset * inset = getInset(); - if (!isEditableInset(inset)) + // is there an editable inset at cursor position? + if (!isEditableInset(inset)) { + // No, try to see if we are inside a collapsable inset + if (inset_owner && inset_owner->owner() + && inset_owner->owner()->isOpen()) { + bview->unlockInset(static_cast(inset_owner->owner())); + inset_owner->owner()->close(bview); + } return; + } //bview->owner()->message(inset->editMessage()); // do we want to keep this?? (JMarc) @@ -481,7 +506,7 @@ void LyXText::makeFontEntriesLayoutSpecific(Buffer const * buf, textclasslist.Style(buf->params.textclass, par->getLayout()); LyXFont layoutfont; - for (Paragraph::size_type pos = 0; pos < par->size(); ++pos) { + for (pos_type pos = 0; pos < par->size(); ++pos) { if (pos < beginningOfMainBody(buf, par)) layoutfont = layout.labelfont; else @@ -497,7 +522,7 @@ void LyXText::makeFontEntriesLayoutSpecific(Buffer const * buf, Paragraph * LyXText::setLayout(BufferView * bview, LyXCursor & cur, LyXCursor & sstart_cur, LyXCursor & send_cur, - LyXTextClass::size_type layout) + lyx::layout_type layout) { Paragraph * endpar = send_cur.par()->next(); Paragraph * undoendpar = endpar; @@ -521,7 +546,7 @@ Paragraph * LyXText::setLayout(BufferView * bview, LyXLayout const & lyxlayout = textclasslist.Style(bview->buffer()->params.textclass, layout); - while (cur.par() != send_cur.par()) { + do { cur.par()->setLayout(layout); makeFontEntriesLayoutSpecific(bview->buffer(), cur.par()); Paragraph * fppar = cur.par(); @@ -538,28 +563,16 @@ Paragraph * LyXText::setLayout(BufferView * bview, delete fppar->bibkey; fppar->bibkey = 0; } - cur.par(cur.par()->next()); - } - cur.par()->setLayout(layout); - makeFontEntriesLayoutSpecific(bview->buffer(), cur.par()); - Paragraph * fppar = cur.par(); - fppar->params().spaceTop(lyxlayout.fill_top ? - VSpace(VSpace::VFILL) : VSpace(VSpace::NONE)); - fppar->params().spaceBottom(lyxlayout.fill_bottom ? - VSpace(VSpace::VFILL) : VSpace(VSpace::NONE)); - if (lyxlayout.margintype == MARGIN_MANUAL) - cur.par()->setLabelWidthString(lyxlayout.labelstring()); - if (lyxlayout.labeltype != LABEL_BIBLIO - && fppar->bibkey) { - delete fppar->bibkey; - fppar->bibkey = 0; - } + if (cur.par() != send_cur.par()) + cur.par(cur.par()->next()); + } while (cur.par() != send_cur.par()); + return endpar; } // set layout over selection and make a total rebreak of those paragraphs -void LyXText::setLayout(BufferView * bview, LyXTextClass::size_type layout) +void LyXText::setLayout(BufferView * bview, lyx::layout_type layout) { LyXCursor tmpcursor = cursor; /* store the current cursor */ @@ -623,19 +636,16 @@ void LyXText::incDepth(BufferView * bview) while (true) { // NOTE: you can't change the depth of a bibliography entry - if ( - textclasslist.Style(bview->buffer()->params.textclass, - cursor.par()->getLayout() - ).labeltype != LABEL_BIBLIO) { + if (textclasslist.Style(bview->buffer()->params.textclass, + cursor.par()->getLayout()).labeltype != LABEL_BIBLIO) { Paragraph * prev = cursor.par()->previous(); - if (prev - && (prev->getDepth() - cursor.par()->getDepth() > 0 - || (prev->getDepth() == cursor.par()->getDepth() - && textclasslist.Style(bview->buffer()->params.textclass, - prev->getLayout()).isEnvironment()))) { - cursor.par()->params().depth(cursor.par()->params().depth() + 1); - anything_changed = true; + if (prev) { + if (cursor.par()->getDepth() + < prev->getMaxDepthAfter(bview->buffer())){ + cursor.par()->params().depth(cursor.par()->getDepth() + 1); + anything_changed = true; + } } } if (cursor.par() == selection.end.par()) @@ -785,11 +795,11 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall) redoParagraphs(bview, selection.start, selection.end.par()->next()); // we have to reset the selection, because the - // geometry could have changed + // geometry could have changed, but we keep + // it for user convenience setCursor(bview, selection.start.par(), selection.start.pos()); selection.cursor = cursor; setCursor(bview, selection.end.par(), selection.end.pos()); - clearSelection(); setSelection(bview); setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true, tmpcursor.boundary()); @@ -857,9 +867,10 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, if (!tmprow->previous()) { // a trick/hack for UNDO - // Can somebody please tell me _why_ this solves - // anything. (Lgb) - first_phys_par = firstParagraph(); + // This is needed because in an UNDO/REDO we could have changed + // the ownerParagrah() so the paragraph inside the row is NOT + // my really first par anymore. Got it Lars ;) (Jug 20011206) + first_phys_par = ownerParagraph(); } else { first_phys_par = tmprow->par(); while (tmprow->previous() @@ -869,7 +880,7 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, y -= tmprow->height(); } } - + // we can set the refreshing parameters now status(bview, LyXText::NEED_MORE_REFRESH); refresh_y = y; @@ -881,13 +892,14 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur, tmppar = tmprow->next()->par(); else tmppar = 0; - while (tmppar != endpar) { + while (tmprow->next() && tmppar != endpar) { removeRow(tmprow->next()); - if (tmprow->next()) + if (tmprow->next()) { tmppar = tmprow->next()->par(); - else + } else { tmppar = 0; - } + } + } // remove the first one tmprow2 = tmprow; /* this is because tmprow->previous() @@ -1006,7 +1018,7 @@ void LyXText::setSelection(BufferView * bview) string const LyXText::selectionAsString(Buffer const * buffer, - bool label) const + bool label) const { if (!selection.set()) return string(); string result; @@ -1051,7 +1063,7 @@ void LyXText::clearSelection() const { selection.set(false); selection.mark(false); - selection.end = selection.start = selection.cursor = cursor; + last_sel_cursor = selection.end = selection.start = selection.cursor = cursor; } @@ -1162,7 +1174,7 @@ string LyXText::getStringToIndex(BufferView * bview) } -Paragraph::size_type LyXText::beginningOfMainBody(Buffer const * buf, +pos_type LyXText::beginningOfMainBody(Buffer const * buf, Paragraph const * par) const { if (textclasslist.Style(buf->params.textclass, @@ -1600,7 +1612,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const par->incCounter(i); int number = par->getCounter(i); if (!par->bibkey) { - InsetCommandParams p( "bibitem" ); + InsetCommandParams p("bibitem" ); par->bibkey = new InsetBibKey(p); } par->bibkey->setCounter(number); @@ -1677,8 +1689,8 @@ void LyXText::insertInset(BufferView * bview, Inset * inset) { if (!cursor.par()->insetAllowed(inset->lyxCode())) return; - setUndo(bview, Undo::INSERT, - cursor.par(), cursor.par()->next()); + // I don't know if this is necessary here (Jug 20020102) + setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next()); cursor.par()->insertInset(cursor.pos(), inset); // Just to rebreak and refresh correctly. // The character will not be inserted a second time @@ -1789,14 +1801,7 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut) void LyXText::copySelection(BufferView * bview) { - // Stuff what we got on the clipboard. Even if there is no selection. - - // There is a problem with having the stuffing here in that the - // larger the selection the slower LyX will get. This can be - // solved by running the line below only when the selection has - // finished. The solution used currently just works, to make it - // faster we need to be more clever and probably also have more - // calls to stuffClipboard. (Lgb) + // stuff the selection onto the X clipboard, from an explicit copy request bview->stuffClipboard(selectionAsString(bview->buffer(), true)); // this doesnt make sense, if there is no selection @@ -1845,13 +1850,6 @@ void LyXText::pasteSelection(BufferView * bview) } -// returns a pointer to the very first Paragraph -Paragraph * LyXText::firstParagraph() const -{ - return ownerParagraph(); -} - - // sets the selection over the number of characters of string, no check!! void LyXText::setSelectionOverString(BufferView * bview, string const & str) { @@ -1878,7 +1876,7 @@ void LyXText::replaceSelectionWithString(BufferView * bview, } // Get font setting before we cut - Paragraph::size_type pos = selection.end.pos(); + pos_type pos = selection.end.pos(); LyXFont const font = selection.start.par() ->getFontSettings(bview->buffer()->params, selection.start.pos()); @@ -1900,7 +1898,7 @@ void LyXText::replaceSelectionWithString(BufferView * bview, void LyXText::insertStringAsLines(BufferView * bview, string const & str) { Paragraph * par = cursor.par(); - Paragraph::size_type pos = cursor.pos(); + pos_type pos = cursor.pos(); Paragraph * endpar = cursor.par()->next(); setCursorParUndo(bview); @@ -1945,7 +1943,7 @@ void LyXText::insertStringAsParagraphs(BufferView * bview, string const & str) bool LyXText::gotoNextInset(BufferView * bview, - std::vector const & codes, + vector const & codes, string const & contents) const { LyXCursor res = cursor; @@ -1976,12 +1974,12 @@ bool LyXText::gotoNextInset(BufferView * bview, void LyXText::checkParagraph(BufferView * bview, Paragraph * par, - Paragraph::size_type pos) + pos_type pos) { LyXCursor tmpcursor; int y = 0; - Paragraph::size_type z; + pos_type z; Row * row = getRow(par, pos, y); // is there a break one row above @@ -2006,7 +2004,7 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par, } int const tmpheight = row->height(); - Paragraph::size_type const tmplast = rowLast(row); + pos_type const tmplast = rowLast(row); refresh_y = y; refresh_row = row; @@ -2069,7 +2067,7 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) // check every paragraph - Paragraph * par = firstParagraph(); + Paragraph * par = ownerParagraph(); do { pos = par->getPositionOfInset(inset); if (pos != -1) { @@ -2083,19 +2081,22 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) } -void LyXText::setCursor(BufferView * bview, Paragraph * par, - Paragraph::size_type pos, +bool LyXText::setCursor(BufferView * bview, Paragraph * par, + pos_type pos, bool setfont, bool boundary) const { LyXCursor old_cursor = cursor; setCursorIntern(bview, par, pos, setfont, boundary); - deleteEmptyParagraphMechanism(bview, old_cursor); + return deleteEmptyParagraphMechanism(bview, old_cursor); } -void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, - Paragraph::size_type pos, bool boundary) const +void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par, + pos_type pos, bool boundary) const { + lyx::Assert(par); + lyx::Assert(bview); + cur.par(par); cur.pos(pos); cur.boundary(boundary); @@ -2114,15 +2115,19 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, float fill_hfill; float fill_label_hfill; prepareToPrint(bview, row, x, fill_separator, fill_hfill, - fill_label_hfill); - Paragraph::size_type cursor_vpos = 0; - Paragraph::size_type last = rowLastPrintable(row); + fill_label_hfill); + pos_type cursor_vpos = 0; + pos_type last = rowLastPrintable(row); - if (pos > last + 1) // This shouldn't happen. + if (pos > last + 1) { + // This shouldn't happen. pos = last + 1; - else if (pos < row->pos()) + cur.pos(pos); + } else if (pos < row->pos()) { pos = row->pos(); - + cur.pos(pos); + } + if (last < row->pos()) cursor_vpos = row->pos(); else if (pos > last && !boundary) @@ -2138,14 +2143,14 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, cursor_vpos = (bidi_level(pos) % 2 == 0) ? log2vis(pos) : log2vis(pos) + 1; - Paragraph::size_type main_body = + pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); if ((main_body > 0) && ((main_body-1 > last) || !row->par()->isLineSeparator(main_body-1))) main_body = 0; - for (Paragraph::size_type vpos = row->pos(); + for (pos_type vpos = row->pos(); vpos < cursor_vpos; ++vpos) { pos = vis2log(vpos); if (main_body > 0 && pos == main_body - 1) { @@ -2173,24 +2178,25 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, } cur.x(int(x)); - cur.x_fix(cur.x()); + cur.x_fix(cur.x()); cur.row(row); } void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, - Paragraph::size_type pos, - bool setfont, bool boundary) const + pos_type pos, bool setfont, bool boundary) const { InsetText * it = static_cast(par->inInset()); if (it) { if (it != inset_owner) { lyxerr << "InsetText is " << it << endl; lyxerr << "inset_owner is " << inset_owner << endl; +#ifdef WITH_WARNINGS #warning I believe this code is wrong. (Lgb) #warning Jürgen, have a look at this. (Lgb) #warning Hmmm, I guess you are right but we #warning should verify when this is needed +#endif // Jürgen, would you like to have a look? // I guess we need to move the outer cursor // and open and lock the inset (bla bla bla) @@ -2199,8 +2205,7 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, // I moved the lyxerr stuff in here so we can see if // this is actually really needed and where! // (Jug) - it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont, - boundary); + // it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont, boundary); return; } } @@ -2213,7 +2218,7 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, void LyXText::setCurrentFont(BufferView * bview) const { - Paragraph::size_type pos = cursor.pos(); + pos_type pos = cursor.pos(); if (cursor.boundary() && pos > 0) --pos; @@ -2265,9 +2270,7 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur, Row * row = getRowNearY(y); bool bound = false; - Paragraph::size_type const column = getColumnNearX(bview, row, x, - bound); - + pos_type const column = getColumnNearX(bview, row, x, bound); cur.par(row->par()); cur.pos(row->pos() + column); cur.x(x); @@ -2363,18 +2366,19 @@ void LyXText::fixCursorAfterDelete(BufferView * bview, } -void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, +bool LyXText::deleteEmptyParagraphMechanism(BufferView * bview, LyXCursor const & old_cursor) const { // Would be wrong to delete anything if we have a selection. - if (selection.set()) return; + if (selection.set()) return false; // We allow all kinds of "mumbo-jumbo" when freespacing. if (textclasslist.Style(bview->buffer()->params.textclass, - old_cursor.par()->getLayout()).free_spacing) - return; - - bool deleted = false; + old_cursor.par()->getLayout()).free_spacing + || old_cursor.par()->isFreeSpacing()) + { + return false; + } /* Ok I'll put some comments here about what is missing. I have fixed BackSpace (and thus Delete) to not delete @@ -2400,7 +2404,8 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, // MISSING // If the pos around the old_cursor were spaces, delete one of them. - if (old_cursor.par() != cursor.par() || old_cursor.pos() != cursor.pos()) { + if (old_cursor.par() != cursor.par() + || old_cursor.pos() != cursor.pos()) { // Only if the cursor has really moved if (old_cursor.pos() > 0 @@ -2428,19 +2433,27 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, fixCursorAfterDelete(bview, toggle_cursor, old_cursor); fixCursorAfterDelete(bview, toggle_end_cursor, old_cursor); - return; + return false; } } + // don't delete anything if this is the ONLY paragraph! + if (!old_cursor.par()->next() && !old_cursor.par()->previous()) + return false; + // Do not delete empty paragraphs with keepempty set. if ((textclasslist.Style(bview->buffer()->params.textclass, old_cursor.par()->getLayout())).keepempty) - return; + return false; // only do our magic if we changed paragraph if (old_cursor.par() == cursor.par()) - return; + return false; + // record if we have deleted a paragraph + // we can't possibly have deleted a paragraph before this point + bool deleted = false; + if ((old_cursor.par()->size() == 0 || (old_cursor.par()->size() == 1 && old_cursor.par()->isLineSeparator(0)))) { @@ -2465,12 +2478,12 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, setUndo(bview, Undo::DELETE, old_cursor.par(), endpar); cursor = tmpcursor; - // delete old row + // delete old row removeRow(old_cursor.row()); if (ownerParagraph() == old_cursor.par()) { ownerParagraph(ownerParagraph()->next()); } - // delete old par + // delete old par delete old_cursor.par(); /* Breakagain the next par. Needed because of @@ -2520,7 +2533,7 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, setCursorIntern(bview, cursor.par(), cursor.pos()); if (selection.cursor.par() == old_cursor.par() - && selection.cursor.pos() == selection.cursor.pos()) { + && selection.cursor.pos() == old_cursor.pos()) { // correct selection selection.cursor = cursor; } @@ -2534,6 +2547,7 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, selection.cursor = cursor; } } + return deleted; } @@ -2543,7 +2557,7 @@ void LyXText::toggleAppendix(BufferView * bview) bool start = !par->params().startOfAppendix(); // ensure that we have only one start_of_appendix in this document - Paragraph * tmp = firstParagraph(); + Paragraph * tmp = ownerParagraph(); for (; tmp; tmp = tmp->next()) { tmp->params().startOfAppendix(false); } @@ -2584,11 +2598,7 @@ void LyXText::ownerParagraph(int id, Paragraph * p) const if (op && op->inInset()) { static_cast(op->inInset())->paragraph(p); } else { - if (inset_owner) { - inset_owner->paragraph(p); - } else { - bv_owner->buffer()->paragraph = p; - } + ownerParagraph(p); } }