On Fri, 2005-03-11 at 09:01, Juergen Spitzmueller wrote: > Martin Vermeer wrote: > > Are you sure this bug report is accurate? > > Yes, 100% reproducible here (in both my trees). > > > I find that inserting a note and doing anything with it does nothing to > > crash lyx... but clicking on an end of paragraph gives precisely the > > above assert. > > I have found out now that there are several ways to trigger this assertion. > Selecting some text with the mouse is another one. > > > Try the following change (works for me): > > > > - if (row.pos() < end && c >= end > > + if (row.pos() < end && c >= end && end < par.size() > > Yes, this works for me too. > > JÃrgen > > P.S.: There is still a way to stick the cursor. If I put the cursor at the > and > of the last paragraph in the test case of bug 1792 and press cursor up, the > cursor moves to the beginning of that paragraph and sticks.
Indeed... as I now understand what is happening here, see the attached patch for your testing and especially edification :-) (I hope the long comment is in proper coding style. I think it is needed here.) Kayvan, this is the fix for your crash. - Martin
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.604
diff -u -r1.604 text2.C
--- text2.C 8 Mar 2005 10:02:02 -0000 1.604
+++ text2.C 11 Mar 2005 09:41:20 -0000
@@ -803,6 +803,13 @@
}
}
+ // The following code is necessary because the cursor position
+ // past the last char in a row is logically equivalent to that
+ // before the first char in the next row. That's why insets
+ // causing row divisions -- Newline and display-style insets --
+ // must be treated specially, so cursor up/down doesn't get
+ // stuck in an air gap -- MV
+ // Newline inset, air gap below:
if (row.pos() < end && c >= end && par.isNewline(end - 1)) {
if (bidi.level(end -1) % 2 == 0)
tmpx -= singleWidth(par, end - 1);
@@ -810,9 +817,14 @@
tmpx += singleWidth(par, end - 1);
c = end - 1;
}
-
- if (row.pos() < end && c >= end
+ // Air gap above display inset:
+ if (row.pos() < end && c >= end && end < par.size()
&& par.isInset(end) && par.getInset(end)->display()) {
+ c = end - 1;
+ }
+ // Air gap below display inset:
+ if (row.pos() < end && c >= end && par.isInset(end - 1)
+ && par.getInset(end - 1)->display()) {
c = end - 1;
}
signature.asc
Description: This is a digitally signed message part
