fix some rand cases

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6349 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-03-05 09:41:49 +00:00
parent 58f79c1b87
commit 40d00da985
3 changed files with 27 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2003-03-05 Lars Gullik Bjønnes <larsbj@gullik.net>
* ParagraphList.C (insert): handle insert right before end()
(erase): fix cases where it can be first or last paragraph.
2003-03-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* paragraph_funcs.C (TeXEnvironment): remove all usage of

View File

@ -88,11 +88,20 @@ ParagraphList::ParagraphList()
ParagraphList::iterator
ParagraphList::insert(ParagraphList::iterator it, Paragraph * par)
{
Paragraph * prev = it->previous();
par->next(&*it);
par->previous(prev);
prev->next(par);
it->previous(par);
if (it != end()) {
Paragraph * prev = it->previous();
par->next(&*it);
par->previous(prev);
prev->next(par);
it->previous(par);
} else {
// Find last par.
Paragraph * last = parlist;
while (last->next())
last = last->next();
last->next(par);
par->previous(last);
}
return iterator(par);
}
@ -112,8 +121,10 @@ void ParagraphList::erase(ParagraphList::iterator it)
Paragraph * prev = it->previous();
Paragraph * next = it->next();
prev->next(next);
next->previous(prev);
if (prev)
prev->next(next);
if (next)
next->previous(prev);
delete &*it;
}

View File

@ -1406,6 +1406,10 @@ void LyXText::breakParagraph(BufferView * bview, char keep_layout)
setHeightOfRow(bview, cursor.row());
#warning Trouble Point! (Lgb)
// When ::breakParagraph is called from within an inset we must
// ensure that the correct ParagraphList is used. Today that is not
// the case and the Buffer::paragraphs is used. Not good. (Lgb)
while (!cursor.par()->next()->empty()
&& cursor.par()->next()->isNewline(0))
cursor.par()->next()->erase(0);