Joost Verburg wrote: > There are also other places where this is used, always without such a > test. So I'm not sure about it.
But it's safer to have it (it was forgotten in the other cases, probably by me). > Attached an updated patch that fixes the crash and bug. > > Joost > table_fix2.patch > Index: insets/insettabular.C > =================================================================== > --- insets/insettabular.C (revision 15086) > +++ insets/insettabular.C (working copy) > @@ -684,6 +684,7 @@ > if (insertAsciiString(cur.bv(), clip, false)) { > // content has been replaced, > // so cursor might be invalid + if (cur.pit() > cur.lastpit()) > + cur.pit() = cur.lastpit(); + if (cur.pos() > cur.lastpos()) > cur.pos() = cur.lastpos(); > bvcur.setCursor(cur); > break; > @@ -733,8 +734,10 @@ > // cursor follows cell: > cur.idx() = > tabular.getCellNumber(i, j); // select this cell only: > + cur.pit() = 0; > cur.pos() = 0; > cur.resetAnchor(); > + cur.pit() = cur.lastpit(); Please remove this second change (this is a separate bug). > cur.pos() = cur.top().lastpos(); > cur.setCursor(cur); > cur.setSelection(); > @@ -1757,6 +1760,7 @@ > } > > // cursor position might be invalid now > + cur.pit() = cur.lastpit(); > cur.pos() = cur.lastpos(); dito (use tests). Jürgen > cur.clearSelection(); > }