From 79d76916142a88153ae1b5211fa98e4120e79b5e Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 1 Jan 2007 09:46:12 +0000 Subject: [PATCH] Recommit Peter's commit from rev 16444. svn commit did not complain... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16452 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TextMetrics.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TextMetrics.C b/src/TextMetrics.C index 4a382f20d5..272e5a5b3c 100644 --- a/src/TextMetrics.C +++ b/src/TextMetrics.C @@ -84,16 +84,18 @@ int numberOfLabelHfills(Paragraph const & par, Row const & row) int numberOfHfills(Paragraph const & par, Row const & row) { - pos_type const last = row.endpos(); + pos_type 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 && par.isHfill(first)) + while (first < last && first < par_size && 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) {