On Sat, Mar 08, 2003 at 04:33:48PM +0000, John Levon wrote: > 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
Here's a better patch. It does two things : 1) Fix the assert by noticing that an entirely empty paragraph shouldn't have any kind of auto-hfill between label and main body, since neither exist. 2) Fix the position of the cursor when a manual label par is empty. Lars, are you groovy with this now ? I understand the problem and have a sensible fix, and on top of that I fixed a UI problem too ! Comments and everything ! john p.s. can I do s/beginningOfMainBody/beginningOfBody/ and related ? We don't have a non-main body afaik 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 19:00:38 -0000 @@ -497,7 +497,7 @@ break; case MARGIN_MANUAL: x += font_metrics::signedWidth(layout->labelindent, labelfont); - if (row->pos() >= row->par()->beginningOfMainBody()) { + if (row->par()->size() && row->pos() >= row->par()->beginningOfMainBody()) { if (!row->par()->getLabelWidthString().empty()) { x += font_metrics::width(row->par()->getLabelWidthString(), labelfont); @@ -1770,8 +1770,17 @@ if (layout->margintype == MARGIN_MANUAL && layout->labeltype == LABEL_MANUAL) { - // one more since labels are left aligned - nlh = row->numberOfLabelHfills() + 1; + /// We might have real hfills in the label part + nlh = row->numberOfLabelHfills(); + + // A manual label par (e.g. List) has an auto-hfill + // between the label text and the "main body" of the + // paragraph too. + // But we don't want to do this auto hfill if the par + // is empty. + if (row->par()->size()) + ++nlh; + if (nlh && !row->par()->getLabelWidthString().empty()) { fill_label_hfill = labelFill(*bview, *row) / nlh; }