From: John Levon Date: Mon, 10 Mar 2003 01:46:40 +0000 (+0000) Subject: fix the row breaking. Sorry all ! X-Git-Tag: 1.6.10~17306 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=376a3cbeab73f7c00f3542da23e798a58e0b035d;p=features.git fix the row breaking. Sorry all ! Anyway, this *should* have one bug less, and be understandable. Guess if my opinion on the "cleverness" of inset-as-metachar has changed (hint: I wasn't a fan) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6408 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 5f4f6511e4..e85f2081d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-03-10 John Levon + + * text.C: fix the last commit + 2003-03-09 John Levon * lyxtext.h: diff --git a/src/text.C b/src/text.C index 8a154ed782..1c117d7051 100644 --- a/src/text.C +++ b/src/text.C @@ -741,7 +741,7 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const x += singleWidth(&bv, par, i, c); // add the auto-hfill from label end to the body - if (i == body_pos) { + if (body_pos && i == body_pos) { x += font_metrics::width(layout->labelsep, getLabelFont(bv.buffer(), par)); if (par->isLineSeparator(i - 1)) @@ -751,11 +751,22 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const x = left_margin; } + Inset * in = par->isInset(i) ? par->getInset(i) : 0; + bool display = (in && (in->display() || in->needFullRow())); + + // check whether a Display() inset is valid here. + // If not, change it to non-display. FIXME: + // we should not be modifying things at this + // point ! + if (in && in->display() && (layout->isCommand() || + (layout->labeltype == LABEL_MANUAL && i < body_pos))) + in->display(false); + // break before a character that will fall off // the right of the row if (x >= width) { - // if no break before, break here. - if (point == last) { + // if no break before or this is a fullrow inset, break here. + if (point == last || display) { if (pos < i) point = i - 1; else @@ -764,44 +775,40 @@ LyXText::rowBreakPoint(BufferView & bv, Row const & row) const break; } - Inset * in = par->isInset(i) ? par->getInset(i) : 0; - if (!in || in->isChar()) { // some insets are line separators too if (par->isLineSeparator(i)) point = i; continue; - } - // check wether a Display() inset is valid here. - // If not, change it to non-display. FIXME: - // we should not be modifying things at this - // point ! - if (in->display() && (layout->isCommand() || - (layout->labeltype == LABEL_MANUAL && i < body_pos))) { - in->display(false); - } else if (in->display() || in->needFullRow()) { - // displayed insets start at a new row - if (i == pos) { - if (pos < last - 1) { - point = i; - if (par->isLineSeparator(i + 1)) - ++point; - } else { - // to avoid extra rows - point = last; - } + if (!display) + continue; + + // full row insets start at a new row + if (i == pos) { + if (pos < last - 1) { + point = i; + if (par->isLineSeparator(i + 1)) + ++point; } else { - point = i - 1; + // to avoid extra rows + point = last; } - break; + } else { + point = i - 1; } + break; } - // didn't find one, break at the point we reached the edge - if (point == last && x >= width) + if (point == last && x >= width) { + // didn't find one, break at the point we reached the edge point = i; + } else if (i == last && x < width) { + // found one, but we fell off the end of the par, so prefer + // that. + point = last; + } // manual labels cannot be broken in LaTeX if (body_pos && point < body_pos)