From 29eb0e10ce2455a4c5c776d5062ed6dcc0ebb8ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 14 Aug 2003 11:56:04 +0000 Subject: [PATCH] more getPar git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7541 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxtext.h | 2 +- src/text.C | 4 ++-- src/text2.C | 38 +++++++------------------------------- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/lyxtext.h b/src/lyxtext.h index 19e1579832..ee31a699bb 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -397,7 +397,7 @@ private: void removeRow(RowList::iterator rit); /// remove all following rows of the paragraph of the specified row. - void removeParagraph(RowList::iterator rit); + void removeParagraph(ParagraphList::iterator pit, RowList::iterator rit); /// insert the specified paragraph behind the specified row void insertParagraph(ParagraphList::iterator pit, diff --git a/src/text.C b/src/text.C index 3087ef14de..714fce9838 100644 --- a/src/text.C +++ b/src/text.C @@ -1391,7 +1391,7 @@ void LyXText::breakParagraph(ParagraphList & paragraphs, char keep_layout) cursorLeft(bv()); } - removeParagraph(cursorRow()); + removeParagraph(cursor.par(), cursorRow()); #warning Trouble Point! (Lgb) // When ::breakParagraph is called from within an inset we must @@ -2101,7 +2101,7 @@ void LyXText::backspace() && (cursor.par()->layout() == tmppit->layout() || tmppit->layout() == tclass.defaultLayout()) && cursor.par()->getAlign() == tmppit->getAlign()) { - removeParagraph(tmprow); + removeParagraph(cursor.par(), tmprow); removeRow(tmprow); mergeParagraph(bv()->buffer()->params, bv()->buffer()->paragraphs, cursor.par()); diff --git a/src/text2.C b/src/text2.C index 9adca2d484..b3cc5fe99c 100644 --- a/src/text2.C +++ b/src/text2.C @@ -261,11 +261,10 @@ void LyXText::removeRow(RowList::iterator rit) // remove all following rows of the paragraph of the specified row. -void LyXText::removeParagraph(RowList::iterator rit) +void LyXText::removeParagraph(ParagraphList::iterator pit, + RowList::iterator rit) { - ParagraphList::iterator pit = getPar(rit); RowList::iterator end = endRow(pit); - for (++rit; rit != end; ) { RowList::iterator rit2 = boost::next(rit); removeRow(rit); @@ -1398,18 +1397,15 @@ void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit, // get the cursor y position in text int y = 0; RowList::iterator row = getRow(pit, pos, y); - RowList::iterator beg = rows().begin(); - RowList::iterator old_row = row; // if we are before the first char of this row and are still in the // same paragraph and there is a previous row then put the cursor on // the end of the previous row cur.iy(y + row->baseline()); - if (row != beg && - pos && - getPar(boost::prior(row)) == getPar(row) && - pos < pit->size() && - pit->getChar(pos) == Paragraph::META_INSET) { + if (row != beginRow(pit) + && pos + && pos < pit->size() + && pit->getChar(pos) == Paragraph::META_INSET) { InsetOld * ins = pit->getInset(pos); if (ins && (ins->needFullRow() || ins->display())) { --row; @@ -1704,7 +1700,7 @@ namespace { RowList::iterator next = boost::next(row); - if (next->pos() != cur.pos() || lt.getPar(next) != cur.par()) + if (next == lt.endRow(cur.par()) || next->pos() != cur.pos()) return false; if (cur.pos() == cur.par()->size() @@ -1983,17 +1979,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) removeRow(getRow(old_cursor)); // delete old par ownerParagraphs().erase(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 */ - RowList::iterator tmprit = boost::next(prevrow); - if (tmprit != rows().end()) { - redoParagraph(getPar(tmprit)); - updateCounters(); - } - setHeightOfRow(getPar(prevrow), prevrow); } else { RowList::iterator nextrow = boost::next(getRow(old_cursor)); @@ -2013,15 +1998,6 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) removeRow(getRow(old_cursor)); // delete old par ownerParagraphs().erase(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 (nextrow != rows().end()) { - redoParagraph(getPar(nextrow)); - updateCounters(); - } } // correct cursor y -- 2.39.2