+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
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);
}
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;
}
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);