X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextMetrics.C;h=63a287a160ca8be97b465852b4d10454c1bc6822;hb=e5a46922e916a06ad1b958d5895cc3cfb4f13d2c;hp=9b9876d3b79127e3483e016e4262d7e9a6eac269;hpb=a64d5ba3627e3667e43423019ac011992f032d73;p=lyx.git diff --git a/src/TextMetrics.C b/src/TextMetrics.C index 9b9876d3b7..63a287a160 100644 --- a/src/TextMetrics.C +++ b/src/TextMetrics.C @@ -85,18 +85,16 @@ int numberOfLabelHfills(Paragraph const & par, Row const & row) int numberOfHfills(Paragraph const & par, Row const & row) { - pos_type last = row.endpos(); + pos_type const last = row.endpos(); pos_type first = row.pos(); - pos_type const par_size = par.size(); // hfill *DO* count at the beginning of paragraphs! if (first) { - while (first < last && first < par_size && par.isHfill(first)) + while (first < last && par.isHfill(first)) ++first; } first = max(first, par.beginOfBody()); - last = min(last, par_size); int n = 0; for (pos_type p = first; p < last; ++p) { @@ -260,6 +258,10 @@ bool TextMetrics::redoParagraph(pit_type const pit) par_metrics_[pit] = pm; + // Update the row change statuses. The painter will need that info + // in order to know which row has to be repainted. + par_metrics_[pit].updateRowChangeStatus(); + return changed; } @@ -705,11 +707,12 @@ void TextMetrics::setHeightOfRow(pit_type const pit, // environment. pit_type prev = depthHook(pit, pars, par.getDepth()); + Paragraph const & prevpar = pars[prev]; if (prev != pit - && pars[prev].layout() == layout - && pars[prev].getDepth() == par.getDepth() - && pars[prev].getLabelWidthString() == par.getLabelWidthString()) - { + && prevpar.layout() == layout + && prevpar.getDepth() == par.getDepth() + && prevpar.getLabelWidthString() + == par.getLabelWidthString()) { layoutasc = layout->itemsep * dh; } else if (pit != 0 || row.pos() != 0) { if (layout->topsep > 0) @@ -720,8 +723,9 @@ void TextMetrics::setHeightOfRow(pit_type const pit, if (prev != pit_type(pars.size())) { maxasc += int(pars[prev].layout()->parsep * dh); } else if (pit != 0) { - if (pars[pit - 1].getDepth() != 0 || - pars[pit - 1].layout() == layout) { + Paragraph const & prevpar = pars[pit - 1]; + if (prevpar.getDepth() != 0 || + prevpar.layout() == layout) { maxasc += int(layout->parsep * dh); } }