X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftext2.C;h=1440f91c561c231dfe5469c97ac90dd470d44efa;hb=08b1fdacad52474c2aceb6e5ff354e8e870ddc47;hp=78be2366657e17e677595970d3e17b4fa70b2949;hpb=271f8d7eec31175f53d012147af164cb27b043ce;p=lyx.git diff --git a/src/text2.C b/src/text2.C index 78be236665..1440f91c56 100644 --- a/src/text2.C +++ b/src/text2.C @@ -38,6 +38,7 @@ #include "font.h" #include "debug.h" #include "lyxrc.h" +#include "lyxrow.h" #include "FloatList.h" #include "language.h" #include "ParagraphParameters.h" @@ -48,6 +49,7 @@ using std::find; using std::endl; using std::find; using std::pair; +using lyx::pos_type; LyXText::LyXText(BufferView * bv) @@ -155,7 +157,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); @@ -239,21 +241,19 @@ 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(); LyXFont font = getFont(buf, par, pos); font.update(fnt, buf->params.language, toggleall); // Let the insets convert their font - if (par->getChar(pos) == Paragraph::META_INSET) { + if (par->isInset(pos)) { Inset * inset = par->getInset(pos); - if (inset) { - if (inset->editable()==Inset::IS_EDITABLE) { - UpdatableInset * uinset = - static_cast(inset); - uinset->setFont(bv, fnt, toggleall, true); - } + if (isEditableInset(inset)) { + UpdatableInset * uinset = + static_cast(inset); + uinset->setFont(bv, fnt, toggleall, true); } } @@ -303,7 +303,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); @@ -355,7 +355,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) { @@ -387,16 +387,11 @@ void LyXText::insertRow(Row * row, Paragraph * par, // removes the row and reset the touched counters void LyXText::removeRow(Row * row) const { - /* this must not happen before the currentrow for clear reasons. - so the trick is just to set the current row onto the previous - row of this row */ - int unused_y; - getRow(row->par(), row->pos(), unused_y); - if (row->next()) row->next()->previous(row->previous()); if (!row->previous()) { firstrow = row->next(); + lyx::Assert(firstrow); } else { row->previous()->next(row->next()); } @@ -451,7 +446,7 @@ Inset * LyXText::getInset() const if (cursor.pos() == 0 && cursor.par()->bibkey) { inset = cursor.par()->bibkey; } else if (cursor.pos() < cursor.par()->size() - && cursor.par()->getChar(cursor.pos()) == Paragraph::META_INSET) { + && cursor.par()->isInset(cursor.pos())) { inset = cursor.par()->getInset(cursor.pos()); } return inset; @@ -461,12 +456,12 @@ Inset * LyXText::getInset() const void LyXText::toggleInset(BufferView * bview) { Inset * inset = getInset(); - if (!inset->editable()) + if (!isEditableInset(inset)) return; //bview->owner()->message(inset->editMessage()); // do we want to keep this?? (JMarc) - if (inset->editable() != Inset::HIGHLY_EDITABLE) + if (!isHighlyEditableInset(inset)) setCursorParUndo(bview); if (inset->isOpen()) { @@ -489,7 +484,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 @@ -505,7 +500,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; @@ -567,7 +562,7 @@ Paragraph * LyXText::setLayout(BufferView * bview, // 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 */ @@ -1013,7 +1008,8 @@ void LyXText::setSelection(BufferView * bview) } -string const LyXText::selectionAsString(Buffer const * buffer) const +string const LyXText::selectionAsString(Buffer const * buffer, + bool label) const { if (!selection.set()) return string(); string result; @@ -1022,7 +1018,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const if (selection.start.par() == selection.end.par()) { result += selection.start.par()->asString(buffer, selection.start.pos(), - selection.end.pos()); + selection.end.pos(), + label); return result; } @@ -1031,7 +1028,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const // First paragraph in selection result += selection.start.par()->asString(buffer, selection.start.pos(), - selection.start.par()->size()) + selection.start.par()->size(), + label) + "\n\n"; // The paragraphs in between (if any) @@ -1039,13 +1037,14 @@ string const LyXText::selectionAsString(Buffer const * buffer) const tmpcur.par(tmpcur.par()->next()); while (tmpcur.par() != selection.end.par()) { result += tmpcur.par()->asString(buffer, 0, - tmpcur.par()->size()) +"\n\n"; + tmpcur.par()->size(), + label) + "\n\n"; tmpcur.par(tmpcur.par()->next()); } // Last paragraph in selection result += selection.end.par()->asString(buffer, 0, - selection.end.pos()); + selection.end.pos(), label); return result; } @@ -1133,8 +1132,7 @@ void LyXText::toggleFree(BufferView * bview, } -string -LyXText::getStringToIndex(BufferView * bview) +string LyXText::getStringToIndex(BufferView * bview) { string idxstring; @@ -1153,7 +1151,7 @@ LyXText::getStringToIndex(BufferView * bview) return string(); } - idxstring = selectionAsString(bview->buffer()); + idxstring = selectionAsString(bview->buffer(), false); // Implicit selections are cleared afterwards //and cursor is set to the original position. @@ -1166,8 +1164,8 @@ LyXText::getStringToIndex(BufferView * bview) return idxstring; } -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, @@ -1189,7 +1187,7 @@ void LyXText::setParagraph(BufferView * bview, bool pagebreak_top, bool pagebreak_bottom, VSpace const & space_top, VSpace const & space_bottom, - Spacing const & spacing, + Spacing const & spacing, LyXAlignment align, string labelwidthstring, bool noindent) @@ -1694,7 +1692,7 @@ void LyXText::insertInset(BufferView * bview, Inset * inset) // inset now after the Undo LyX tries to call inset->Edit(...) again // and cannot do this as the cursor is behind the inset and GetInset // does not return the inset! - if (inset->editable() == Inset::HIGHLY_EDITABLE) { + if (isHighlyEditableInset(inset)) { cursorLeft(bview, true); } #endif @@ -1723,7 +1721,7 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut) // 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) - bview->stuffClipboard(selectionAsString(bview->buffer())); + bview->stuffClipboard(selectionAsString(bview->buffer(), true)); // This doesn't make sense, if there is no selection if (!selection.set()) @@ -1756,16 +1754,16 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut) int pos = selection.end.pos(); CutAndPaste::cutSelection(selection.start.par(), &endpar, selection.start.pos(), pos, - bview->buffer()->params.textclass, doclear, - realcut); + bview->buffer()->params.textclass, + doclear, realcut); selection.end.pos(pos); } else { endpar = selection.end.par(); int pos = selection.end.pos(); CutAndPaste::cutSelection(selection.start.par(), &endpar, selection.start.pos(), pos, - bview->buffer()->params.textclass, doclear, - realcut); + bview->buffer()->params.textclass, + doclear, realcut); cursor.par(endpar); selection.end.par(endpar); selection.end.pos(pos); @@ -1802,7 +1800,7 @@ void LyXText::copySelection(BufferView * bview) // 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) - bview->stuffClipboard(selectionAsString(bview->buffer())); + bview->stuffClipboard(selectionAsString(bview->buffer(), true)); // this doesnt make sense, if there is no selection if (!selection.set()) @@ -1835,8 +1833,8 @@ void LyXText::pasteSelection(BufferView * bview) Paragraph * endpar; Paragraph * actpar = cursor.par(); - int pos = cursor.pos(); + CutAndPaste::pasteSelection(&actpar, &endpar, pos, bview->buffer()->params.textclass); @@ -1845,9 +1843,7 @@ void LyXText::pasteSelection(BufferView * bview) setCursor(bview, cursor.par(), cursor.pos()); clearSelection(); - selection.cursor = cursor; setCursor(bview, actpar, pos); - setSelection(bview); updateCounters(bview, cursor.row()); } @@ -1885,7 +1881,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()); @@ -1907,7 +1903,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); @@ -1966,7 +1962,7 @@ bool LyXText::gotoNextInset(BufferView * bview, } } while (res.par() && - !(res.par()->getChar(res.pos()) == Paragraph::META_INSET + !(res.par()->isInset(res.pos()) && (inset = res.par()->getInset(res.pos())) != 0 && find(codes.begin(), codes.end(), inset->lyxCode()) != codes.end() @@ -1975,7 +1971,7 @@ bool LyXText::gotoNextInset(BufferView * bview, == contents))); if (res.par()) { - setCursor(bview, res.par(), res.pos()); + setCursor(bview, res.par(), res.pos(), false); return true; } return false; @@ -1983,12 +1979,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 @@ -2013,7 +2009,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; @@ -2026,7 +2022,8 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par, // check the special right address boxes if (textclasslist.Style(bview->buffer()->params.textclass, par->getLayout()).margintype - == MARGIN_RIGHT_ADDRESS_BOX) { + == MARGIN_RIGHT_ADDRESS_BOX) + { tmpcursor.par(par); tmpcursor.row(row); tmpcursor.y(y); @@ -2068,7 +2065,7 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) { // first check the current paragraph int pos = cursor.par()->getPositionOfInset(inset); - if (pos != -1){ + if (pos != -1) { checkParagraph(bview, cursor.par(), pos); return true; } @@ -2078,7 +2075,7 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) Paragraph * par = firstParagraph(); do { pos = par->getPositionOfInset(inset); - if (pos != -1){ + if (pos != -1) { checkParagraph(bview, par, pos); return true; } @@ -2090,7 +2087,7 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset) void LyXText::setCursor(BufferView * bview, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, bool setfont, bool boundary) const { LyXCursor old_cursor = cursor; @@ -2100,7 +2097,7 @@ void LyXText::setCursor(BufferView * bview, Paragraph * par, void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, - Paragraph::size_type pos, bool boundary) const + pos_type pos, bool boundary) const { cur.par(par); cur.pos(pos); @@ -2113,7 +2110,7 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, y += row->baseline(); // y is now the cursor baseline cur.y(y); - + // now get the cursors x position float x; float fill_separator; @@ -2121,8 +2118,8 @@ void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, 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); + pos_type cursor_vpos = 0; + pos_type last = rowLastPrintable(row); if (pos > last + 1) // This shouldn't happen. pos = last + 1; @@ -2144,14 +2141,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) { @@ -2179,13 +2176,13 @@ 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, + pos_type pos, bool setfont, bool boundary) const { InsetText * it = static_cast(par->inInset()); @@ -2193,7 +2190,7 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, if (it != inset_owner) { lyxerr << "InsetText is " << it << endl; lyxerr << "inset_owner is " << inset_owner << endl; -#warning I belive this code is wrong. (Lgb) +#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 @@ -2219,7 +2216,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; @@ -2271,8 +2268,7 @@ void LyXText::setCursorFromCoordinates(BufferView * bview, LyXCursor & cur, Row * row = getRowNearY(y); bool bound = false; - int 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); @@ -2347,10 +2343,34 @@ void LyXText::cursorDownParagraph(BufferView * bview) const } } +// fix the cursor `cur' after a characters has been deleted at `where' +// position. Called by deleteEmptyParagraphMechanism +void LyXText::fixCursorAfterDelete(BufferView * bview, + LyXCursor & cur, + LyXCursor const & where) const +{ + // if cursor is not in the paragraph where the delete occured, + // do nothing + if (cur.par() != where.par()) + return; + + // if cursor position is after the place where the delete occured, + // update it + if (cur.pos() > where.pos()) + cur.pos(cur.pos()-1); + + // recompute row et al. for this cursor + setCursor(bview, cur, cur.par(), cur.pos(), cur.boundary()); +} + void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, LyXCursor const & old_cursor) const { + // don't delete anything if this is the ONLY paragraph! + if (!old_cursor.par()->next() && !old_cursor.par()->previous()) + return; + // Would be wrong to delete anything if we have a selection. if (selection.set()) return; @@ -2394,14 +2414,25 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, && old_cursor.par()->isLineSeparator(old_cursor.pos() - 1)) { old_cursor.par()->erase(old_cursor.pos() - 1); redoParagraphs(bview, old_cursor, old_cursor.par()->next()); - // correct cursor - if (old_cursor.par() == cursor.par() && - cursor.pos() > old_cursor.pos()) { - setCursorIntern(bview, cursor.par(), - cursor.pos() - 1); - } else - setCursorIntern(bview, cursor.par(), - cursor.pos()); + +#ifdef WITH_WARNINGS +#warning This will not work anymore when we have multiple views of the same buffer +// In this case, we will have to correct also the cursors held by +// other bufferviews. It will probably be easier to do that in a more +// automated way in LyXCursor code. (JMarc 26/09/2001) +#endif + // correct all cursors held by the LyXText + fixCursorAfterDelete(bview, cursor, old_cursor); + fixCursorAfterDelete(bview, selection.cursor, + old_cursor); + fixCursorAfterDelete(bview, selection.start, + old_cursor); + fixCursorAfterDelete(bview, selection.end, old_cursor); + fixCursorAfterDelete(bview, last_sel_cursor, + old_cursor); + fixCursorAfterDelete(bview, toggle_cursor, old_cursor); + fixCursorAfterDelete(bview, toggle_end_cursor, + old_cursor); return; } } @@ -2411,107 +2442,101 @@ void LyXText::deleteEmptyParagraphMechanism(BufferView * bview, old_cursor.par()->getLayout())).keepempty) return; - LyXCursor tmpcursor; - - if (old_cursor.par() != cursor.par()) { - if ((old_cursor.par()->size() == 0 - || (old_cursor.par()->size() == 1 - && old_cursor.par()->isLineSeparator(0)))) { - // ok, we will delete anything - - // make sure that you do not delete any environments - status(bview, LyXText::NEED_MORE_REFRESH); - deleted = true; + // only do our magic if we changed paragraph + if (old_cursor.par() == cursor.par()) + return; + + if ((old_cursor.par()->size() == 0 + || (old_cursor.par()->size() == 1 + && old_cursor.par()->isLineSeparator(0)))) { + // ok, we will delete anything + LyXCursor tmpcursor; + + // make sure that you do not delete any environments + status(bview, LyXText::NEED_MORE_REFRESH); + deleted = true; - if (old_cursor.row()->previous()) { - refresh_row = old_cursor.row()->previous(); - refresh_y = old_cursor.y() - old_cursor.row()->baseline() - refresh_row->height(); - tmpcursor = cursor; - cursor = old_cursor; // that undo can restore the right cursor position - Paragraph * endpar = old_cursor.par()->next(); - if (endpar && endpar->getDepth()) { - while (endpar && endpar->getDepth()) { - endpar = endpar->next(); - } + if (old_cursor.row()->previous()) { + refresh_row = old_cursor.row()->previous(); + refresh_y = old_cursor.y() - old_cursor.row()->baseline() - refresh_row->height(); + tmpcursor = cursor; + cursor = old_cursor; // that undo can restore the right cursor position + Paragraph * endpar = old_cursor.par()->next(); + if (endpar && endpar->getDepth()) { + while (endpar && endpar->getDepth()) { + endpar = endpar->next(); } - setUndo(bview, Undo::DELETE, - old_cursor.par(), - endpar); - cursor = tmpcursor; + } + setUndo(bview, Undo::DELETE, old_cursor.par(), endpar); + cursor = tmpcursor; // delete old row - removeRow(old_cursor.row()); - if (ownerParagraph() == old_cursor.par()) { - ownerParagraph(ownerParagraph()->next()); - } + removeRow(old_cursor.row()); + if (ownerParagraph() == old_cursor.par()) { + ownerParagraph(ownerParagraph()->next()); + } // delete old par - delete old_cursor.par(); + delete old_cursor.par(); - /* Breakagain the next par. Needed - * because of the parindent that - * can occur or dissappear. The - * next row can change its height, - * if there is another layout before */ - if (refresh_row->next()) { - breakAgain(bview, refresh_row->next()); - updateCounters(bview, refresh_row); - } - setHeightOfRow(bview, refresh_row); - } else { - refresh_row = old_cursor.row()->next(); - refresh_y = old_cursor.y() - old_cursor.row()->baseline(); + /* Breakagain the next par. Needed because of + * the parindent that can occur or dissappear. + * The next row can change its height, if + * there is another layout before */ + if (refresh_row->next()) { + breakAgain(bview, refresh_row->next()); + updateCounters(bview, refresh_row); + } + setHeightOfRow(bview, refresh_row); + } else { + refresh_row = old_cursor.row()->next(); + refresh_y = old_cursor.y() - old_cursor.row()->baseline(); - tmpcursor = cursor; - cursor = old_cursor; // that undo can restore the right cursor position - Paragraph * endpar = old_cursor.par()->next(); - if (endpar && endpar->getDepth()) { - while (endpar && endpar->getDepth()) { - endpar = endpar->next(); - } - } - setUndo(bview, Undo::DELETE, - old_cursor.par(), - endpar); - cursor = tmpcursor; - - // delete old row - removeRow(old_cursor.row()); - // delete old par - if (ownerParagraph() == old_cursor.par()) { - ownerParagraph(ownerParagraph()->next()); + tmpcursor = cursor; + cursor = old_cursor; // that undo can restore the right cursor position + Paragraph * endpar = old_cursor.par()->next(); + if (endpar && endpar->getDepth()) { + while (endpar && endpar->getDepth()) { + endpar = endpar->next(); } + } + setUndo(bview, Undo::DELETE, old_cursor.par(), endpar); + cursor = tmpcursor; + + // delete old row + removeRow(old_cursor.row()); + // delete old par + if (ownerParagraph() == old_cursor.par()) { + ownerParagraph(ownerParagraph()->next()); + } - delete old_cursor.par(); + delete old_cursor.par(); - /* Breakagain the next par. Needed - because of the parindent that can - occur or dissappear. - The next row can change its height, - if there is another layout before - */ - if (refresh_row) { - breakAgain(bview, refresh_row); - updateCounters(bview, refresh_row->previous()); - } + /* Breakagain the next par. Needed because of + the parindent that can occur or dissappear. + The next row can change its height, if + there is another layout before */ + if (refresh_row) { + breakAgain(bview, refresh_row); + updateCounters(bview, refresh_row->previous()); } + } - // correct cursor y + // correct cursor y + setCursorIntern(bview, cursor.par(), cursor.pos()); - setCursorIntern(bview, cursor.par(), cursor.pos()); - - if (selection.cursor.par() == old_cursor.par() - && selection.cursor.pos() == selection.cursor.pos()) { - // correct selection - selection.cursor = cursor; - } + if (selection.cursor.par() == old_cursor.par() + && selection.cursor.pos() == selection.cursor.pos()) { + // correct selection + selection.cursor = cursor; } - if (!deleted) { - if (old_cursor.par()->stripLeadingSpaces(bview->buffer()->params.textclass)) { - redoParagraphs(bview, old_cursor, old_cursor.par()->next()); - // correct cursor y - setCursorIntern(bview, cursor.par(), cursor.pos()); - selection.cursor = cursor; - } + } + if (!deleted) { + if (old_cursor.par()->stripLeadingSpaces(bview->buffer()->params.textclass)) { + redoParagraphs(bview, old_cursor, + old_cursor.par()->next()); + // correct cursor y + setCursorIntern(bview, cursor.par(), cursor.pos()); + selection.cursor = cursor; } } } @@ -2548,17 +2573,17 @@ Paragraph * LyXText::ownerParagraph() const } -Paragraph * LyXText::ownerParagraph(Paragraph * p) const +void LyXText::ownerParagraph(Paragraph * p) const { if (inset_owner) { inset_owner->paragraph(p); } else { bv_owner->buffer()->paragraph = p; } - return 0; } -Paragraph * LyXText::ownerParagraph(int id, Paragraph * p) const + +void LyXText::ownerParagraph(int id, Paragraph * p) const { Paragraph * op = bv_owner->buffer()->getParFromID(id); if (op && op->inInset()) { @@ -2570,7 +2595,6 @@ Paragraph * LyXText::ownerParagraph(int id, Paragraph * p) const bv_owner->buffer()->paragraph = p; } } - return 0; }