Fix two empty manual-label cases.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6394 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-08 19:31:09 +00:00
parent 65f548906a
commit 060e6bc6af
2 changed files with 22 additions and 3 deletions

View 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> 2003-03-08 Lars Gullik Bjønnes <larsbj@gullik.net>
* CutAndPaste.C: remove commented code and reindent. * CutAndPaste.C: remove commented code and reindent.

View File

@ -497,7 +497,8 @@ int LyXText::leftMargin(BufferView * bview, Row const * row) const
break; break;
case MARGIN_MANUAL: case MARGIN_MANUAL:
x += font_metrics::signedWidth(layout->labelindent, labelfont); 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()) { if (!row->par()->getLabelWidthString().empty()) {
x += font_metrics::width(row->par()->getLabelWidthString(), x += font_metrics::width(row->par()->getLabelWidthString(),
labelfont); labelfont);
@ -1770,8 +1771,17 @@ void LyXText::prepareToPrint(BufferView * bview,
if (layout->margintype == MARGIN_MANUAL if (layout->margintype == MARGIN_MANUAL
&& layout->labeltype == LABEL_MANUAL) { && layout->labeltype == LABEL_MANUAL) {
// one more since labels are left aligned /// We might have real hfills in the label part
nlh = row->numberOfLabelHfills() + 1; 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()) { if (nlh && !row->par()->getLabelWidthString().empty()) {
fill_label_hfill = labelFill(*bview, *row) / nlh; fill_label_hfill = labelFill(*bview, *row) / nlh;
} }