]> git.lyx.org Git - features.git/commitdiff
Fix two empty manual-label cases.
authorJohn Levon <levon@movementarian.org>
Sat, 8 Mar 2003 19:31:09 +0000 (19:31 +0000)
committerJohn Levon <levon@movementarian.org>
Sat, 8 Mar 2003 19:31:09 +0000 (19:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6394 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text.C

index 9d6b2c3bdc12287ca2394e71a63b0633f60ba2b8..0f9fca01f38487cd887360d037e0ae14f7da11ed 100644 (file)
@@ -1,3 +1,12 @@
+2003-03-08  John Levon  <levon@movementarian.org>
+
+       * 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  <larsbj@gullik.net>
 
        * CutAndPaste.C: remove commented code and reindent.
index 9715db5a43ea62d3489bf45c8e71716ac00d5001..a6fc34b73dde74f173b98f633088fcb11a2a9b1d 100644 (file)
@@ -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;
                }