bug #174 now fixed

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3389 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Allan Rae 2002-01-16 12:57:26 +00:00
parent 20c3ddcaba
commit 6fb6cd8cc4
3 changed files with 34 additions and 8 deletions

View File

@ -1,3 +1,13 @@
2002-01-16 Allan Rae <rae@lyx.org>
* text2.C (removeRow): refresh_row needs a valid row. Or does it?
Can someone check this please?
* text.C (drawInset): It was possible that p.row would be removed by
breakAgainOneRow upsetting a few other settings. There may be another
small tweak possible by setting need_break_row = 0 when p.row has been
removed but I don't know enough about the logic here.
2002-01-15 Allan Rae <rae@lyx.org>
* text.C (insertChar): removed conditional truism.

View File

@ -485,9 +485,19 @@ void LyXText::drawInset(DrawRowParams & p, pos_type const pos)
Row * prev = p.row->previous();
if (prev && prev->par() == p.row->par()) {
breakAgainOneRow(p.bv, prev);
}
// breakAgainOneRow() may have removed p.row
// What about the x and y coordinates? par & pos ok.
if (prev->next() != p.row) {
p.row = prev;
}
// If there's only one row (after p.row was deleted)
// prev->next() == 0 and no breaking is required.
// Otherwise, check the new next row.
need_break_row = prev->next();
} else {
need_break_row = p.row;
}
setCursor(p.bv, cursor.par(), cursor.pos());
need_break_row = p.row;
}
}

View File

@ -389,17 +389,23 @@ 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();
}
height -= row->height(); // the text becomes smaller
delete row;