Georg Baum wrote:
If you do

if (cur.pit() > cur.lastpit())
        cur.pit() = cur.lastpit();

then it is even suitable for 1.4.3 IMHO. I am not sure whether the test is
necessary, but cur.pit() > cur.lastpit() is clearly wrong.

There are also other places where this is used, always without such a test. So I'm not sure about it.

Attached an updated patch that fixes the crash and bug.

Joost
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
+                               cur.pit() = cur.lastpit();
                                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();
                                        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();
        cur.clearSelection();
 }

Reply via email to