On Sat, Mar 08, 2003 at 04:04:25PM +0000, John Levon wrote:
> I'm bad ... I changed an Asger (aka fix-up-the-bug) into a real
> Assert to see what would happen, but I forgot to leave a comment there.
> Now we have a simple testcase which is fab. We can actually kill the
> bug not do the moral equivalent of if (!this) return;
I give up. Lars, a little help here ... the cursor behaves oddly on an
empty list par as well I noticed. The patch below restores the old
behaviour if that's all you want
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.299
diff -u -r1.299 text.C
--- text.C 6 Mar 2003 20:21:16 -0000 1.299
+++ text.C 8 Mar 2003 16:29:53 -0000
@@ -858,21 +858,27 @@
{
pos_type last = row.par()->beginningOfMainBody();
- lyx::Assert(last > 0);
+ int w = 0;
+
+ if (last) {
+
+ lyx::Assert(last > 0);
- // -1 because a label ends either with a space that is in the label,
- // or with the beginning of a footnote that is outside the label.
- --last;
+ // FIXME: last can still become negative here !
- // a separator at this end does not count
- if (row.par()->isLineSeparator(last))
+ // -1 because a label ends either with a space that is in the label,
+ // or with the beginning of a footnote that is outside the label.
--last;
- int w = 0;
- pos_type i = row.pos();
- while (i <= last) {
- w += singleWidth(&bview, row.par(), i);
- ++i;
+ // a separator at this end does not count
+ if (row.par()->isLineSeparator(last))
+ --last;
+
+ pos_type i = row.pos();
+ while (i <= last) {
+ w += singleWidth(&bview, row.par(), i);
+ ++i;
+ }
}
int fill = 0;
@@ -880,6 +886,9 @@
if (!labwidstr.empty()) {
LyXFont const labfont = getLabelFont(bview.buffer(), row.par());
int const labwidth = font_metrics::width(labwidstr, labfont);
+ /* The pixel space between the end of the label text, and the width
+ * of the label 'column'
+ */
fill = max(labwidth - w, 0);
}