diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 08b74fc862..b17408cee7 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -432,7 +432,7 @@ bool TextMetrics::redoParagraph(pit_type const pit) if (row_index || end < par.size()) // If there is more than one row, expand the text to // the full allowable width. This setting here is needed - // for the computeRowMetrics below(). + // for the computeRowMetrics() below. dim_.wid = max_width_; dim.wid = rowWidth(right_margin, pit, first, end); @@ -448,7 +448,8 @@ bool TextMetrics::redoParagraph(pit_type const pit) else row.setSelection(-1, -1); row.setDimension(dim); - computeRowMetrics(pit, row); + int const max_row_width = max(dim_.wid, dim.wid); + computeRowMetrics(pit, row, max_row_width); pm.computeRowSignature(row, bparams); first = end; ++row_index; @@ -473,7 +474,8 @@ bool TextMetrics::redoParagraph(pit_type const pit) row.pos(first); row.endpos(first); row.setDimension(dim); - computeRowMetrics(pit, row); + int const max_row_width = max(dim_.wid, dim.wid); + computeRowMetrics(pit, row, max_row_width); pm.computeRowSignature(row, bparams); pm.dim().des += dim.height(); } @@ -488,7 +490,7 @@ bool TextMetrics::redoParagraph(pit_type const pit) void TextMetrics::computeRowMetrics(pit_type const pit, - Row & row) const + Row & row, int width) const { row.label_hfill = 0; @@ -498,7 +500,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit, Buffer & buffer = bv_->buffer(); Paragraph const & par = text_->getPar(pit); - double w = dim_.wid - row.width(); + double w = width - row.width(); // FIXME: put back this assertion when the crash on new doc is solved. //BOOST_ASSERT(w >= 0); diff --git a/src/TextMetrics.h b/src/TextMetrics.h index ec36bff31c..45cad7b038 100644 --- a/src/TextMetrics.h +++ b/src/TextMetrics.h @@ -125,7 +125,7 @@ public: /** this calculates the specified parameters. needed when setting * the cursor and when creating a visible row */ - void computeRowMetrics(pit_type pit, Row & row) const; + void computeRowMetrics(pit_type pit, Row & row, int width) const; /// void draw(PainterInfo & pi, int x, int y) const;