Joost Verburg wrote: > You are right! I compiled a debug version and this was exactly where it > crashed when pressing delete. Your patch solves the problem. > > At first I didn't notice because I triggered the crash by changing the > text style. So there are some more places where the same error is made > with lastpos.
Yes, I noticed that, too. > With the attached patch it doesn't crash anymore. Good. I only wonder if, instead of explicitely setting pit and pos to lastpos always, we shouldn't use cur.fixIfBroken(), which only resets the cursor if it is really invalid. But maybe that's overkill here. > There is still one odd > thing: When applying a text style to a number of selected cells in my > example file, only the first list item actually gets the style (this bug > also existed before the patch). Yes, I see why (fixed in the attached patch). We should fix this after 1.4.3, though. IMO this whole LFUN_TRANSPOSE_CHARS should be rewritten, maybe using ParagraphList. Jürgen
Index: src/insets/insettabular.C =================================================================== --- src/insets/insettabular.C (Revision 15069) +++ src/insets/insettabular.C (Arbeitskopie) @@ -474,7 +474,8 @@ void InsetTabular::doDispatch(LCursor & //lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl; if (cmd.button() == mouse_button::button1 - || cmd.button() == mouse_button::button3) { + || (cmd.button() == mouse_button::button3 + && (&bvcur.selBegin().inset() != this || !tablemode(bvcur)))) { cur.selection() = false; setCursorFromCoordinates(cur, cmd.x, cmd.y); cur.resetAnchor(); @@ -684,6 +685,7 @@ void InsetTabular::doDispatch(LCursor & if (insertAsciiString(cur.bv(), clip, false)) { // content has been replaced, // so cursor might be invalid + cur.pit() = cur.lastpit(); cur.pos() = cur.lastpos(); bvcur.setCursor(cur); break; @@ -734,7 +736,9 @@ void InsetTabular::doDispatch(LCursor & cur.idx() = tabular.getCellNumber(i, j); // select this cell only: cur.pos() = 0; + cur.pit() = 0; cur.resetAnchor(); + cur.pit() = cur.lastpit(); cur.pos() = cur.top().lastpos(); cur.setCursor(cur); cur.setSelection(); @@ -1757,6 +1761,7 @@ void InsetTabular::cutSelection(LCursor } // cursor position might be invalid now + cur.pit() = cur.lastpit(); cur.pos() = cur.lastpos(); cur.clearSelection(); }