From: John Levon Date: Sat, 8 Mar 2003 19:31:09 +0000 (+0000) Subject: Fix two empty manual-label cases. X-Git-Tag: 1.6.10~17318 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=060e6bc6af1c94a77a738da771f3e5cc89132aab;p=features.git Fix two empty manual-label cases. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6394 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 9d6b2c3bdc..0f9fca01f3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2003-03-08 John Levon + + * text.C (leftMargin): The left margin of an empty + manual label paragraph should not include the label width + string length. + + * text.C (prepareToPrint): don't attempt to measure hfills + for empty manual label paragraphs - the answer should be 0 + 2003-03-08 Lars Gullik Bjønnes * CutAndPaste.C: remove commented code and reindent. diff --git a/src/text.C b/src/text.C index 9715db5a43..a6fc34b73d 100644 --- a/src/text.C +++ b/src/text.C @@ -497,7 +497,8 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const break; case MARGIN_MANUAL: x += font_metrics::signedWidth(layout->labelindent, labelfont); - if (row->pos() >= row->par()->beginningOfMainBody()) { + // The width of an empty par, even with manual label, should be 0 + if (!row->par()->empty() && row->pos() >= row->par()->beginningOfMainBody()) { if (!row->par()->getLabelWidthString().empty()) { x += font_metrics::width(row->par()->getLabelWidthString(), labelfont); @@ -1770,8 +1771,17 @@ void LyXText::prepareToPrint(BufferView * bview, 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; }