fix break before minipages too

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6411 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-10 04:59:48 +00:00
parent ba9cdda813
commit 901c092504
2 changed files with 23 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2003-03-10 John Levon <levon@movementarian.org>
* text.C: fix break before a minipage
2003-03-10 John Levon <levon@movementarian.org> 2003-03-10 John Levon <levon@movementarian.org>
* text.C: fix the last commit * text.C: fix the last commit

View File

@ -727,7 +727,11 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const
// or the end of the par, then choose the possible break // or the end of the par, then choose the possible break
// nearest that. // nearest that.
int x = leftMargin(&bv, &row); int const left = leftMargin(&bv, &row);
int x = left;
// pixel width since last breakpoint
int chunkwidth = 0;
for (i = pos; i < last; ++i) { for (i = pos; i < last; ++i) {
@ -738,19 +742,22 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const
break; break;
} }
x += singleWidth(&bv, par, i, c); int thiswidth = singleWidth(&bv, par, i, c);
// 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) {
x += font_metrics::width(layout->labelsep, thiswidth += font_metrics::width(layout->labelsep,
getLabelFont(bv.buffer(), par)); getLabelFont(bv.buffer(), par));
if (par->isLineSeparator(i - 1)) if (par->isLineSeparator(i - 1))
x-= singleWidth(&bv, par, i - 1); thiswidth -= singleWidth(&bv, par, i - 1);
int left_margin = labelEnd(bv, row); int left_margin = labelEnd(bv, row);
if (x < left_margin) if (thiswidth < left_margin)
x = left_margin; thiswidth = left_margin;
} }
x += thiswidth;
chunkwidth += thiswidth;
Inset * in = par->isInset(i) ? par->getInset(i) : 0; Inset * in = par->isInset(i) ? par->getInset(i) : 0;
bool display = (in && (in->display() || in->needFullRow())); bool display = (in && (in->display() || in->needFullRow()));
@ -765,8 +772,9 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const
// break before a character that will fall off // break before a character that will fall off
// the right of the row // the right of the row
if (x >= width) { if (x >= width) {
// if no break before or this is a fullrow inset, break here. // if no break before or we are at an inset
if (point == last || display) { // that will take up a row, break here
if (point == last || display || chunkwidth >= (width - left)) {
if (pos < i) if (pos < i)
point = i - 1; point = i - 1;
else else
@ -777,8 +785,10 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const
if (!in || in->isChar()) { if (!in || in->isChar()) {
// some insets are line separators too // some insets are line separators too
if (par->isLineSeparator(i)) if (par->isLineSeparator(i)) {
point = i; point = i;
chunkwidth = 0;
}
continue; continue;
} }