fix row breaking again ..

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6775 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-04-11 03:28:06 +00:00
parent ce4ce89ea0
commit 08b29513b3
2 changed files with 31 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2003-04-11 John Levon <levon@movementarian.org>
* text.C (rowBreakPoint): reintroduce the labelEnd
checks, code copied from the row fill stuff. Deep voodoo.
* text.C (fill): add a comment and debugging for the
next poor soul.
2003-04-11 John Levon <levon@movementarian.org> 2003-04-11 John Levon <levon@movementarian.org>
* text.C: make sure fullrow insets get wrapped to the next line, * text.C: make sure fullrow insets get wrapped to the next line,

View File

@ -793,14 +793,20 @@ LyXText::rowBreakPoint(Row const & row) const
char const c = pit->getChar(i); char const c = pit->getChar(i);
int thiswidth = singleWidth(pit, i, c); int thiswidth;
// add the auto-hfill from label end to the body // add the auto-hfill from label end to the body
if (body_pos && i == body_pos) { if (body_pos && i == body_pos) {
thiswidth += font_metrics::width(layout->labelsep, thiswidth = font_metrics::width(layout->labelsep,
getLabelFont(bv()->buffer(), pit)); getLabelFont(bv()->buffer(), pit));
if (pit->isLineSeparator(i - 1)) if (pit->isLineSeparator(i - 1))
thiswidth -= singleWidth(pit, i - 1); thiswidth -= singleWidth(pit, i - 1);
int left_margin = labelEnd(row);
if (thiswidth + x < left_margin)
thiswidth = left_margin - x;
thiswidth += singleWidth(pit, i, c);
} else {
thiswidth = singleWidth(pit, i, c);
} }
x += thiswidth; x += thiswidth;
@ -918,6 +924,20 @@ int LyXText::fill(RowList::iterator row, int paper_width) const
} }
int const fill = paper_width - w - rightMargin(*bv()->buffer(), *row); int const fill = paper_width - w - rightMargin(*bv()->buffer(), *row);
// If this case happens, it means that our calculation
// of the widths of the chars when we do rowBreakPoint()
// went wrong for some reason. Typically in list bodies.
// Things just about hobble on anyway, though you'll end
// up with a "fill_separator" less than zero, which corresponds
// to inter-word spacing being too small. Hopefully this problem
// will die when the label hacks die.
if (lyxerr.debugging() && fill < 0) {
lyxerr[Debug::GUI] << "Eek, fill() was < 0: " << fill
<< " w " << w << " paper_width " << paper_width
<< " right margin " << rightMargin(*bv()->buffer(), *row) << endl;
}
return fill; return fill;
} }