From: Abdelrazak Younes Date: Fri, 28 Sep 2007 08:19:03 +0000 (+0000) Subject: * BufferView::updateMetrics(): allows the SinglePar optimization to proceed if the... X-Git-Tag: 1.6.10~8142 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e0f7fde3b645b2344937dcee87560a5dde153684;p=features.git * BufferView::updateMetrics(): allows the SinglePar optimization to proceed if the paragraph height did not change. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20562 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 21a3c9f67a..142faf5d71 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1440,28 +1440,31 @@ void BufferView::updateMetrics(bool singlepar) pit_type const bottom_pit = cursor_.bottom().pit(); // If the paragraph metrics has changed, we can not // use the singlepar optimisation. - if (singlepar + if (singlepar) { + int old_height = tm.parMetrics(bottom_pit).height(); // In Single Paragraph mode, rebreak only // the (main text, not inset!) paragraph containing the cursor. // (if this paragraph contains insets etc., rebreaking will // recursively descend) - && !tm.redoParagraph(bottom_pit)) { - - updateOffsetRef(); - // collect cursor paragraph iter bounds - ParagraphMetrics const & pm = tm.parMetrics(bottom_pit); - int y1 = pm.position() - pm.ascent(); - int y2 = pm.position() + pm.descent(); - metrics_info_ = ViewMetricsInfo(bottom_pit, bottom_pit, y1, y2, - SingleParUpdate, npit); - LYXERR(Debug::PAINTING) - << BOOST_CURRENT_FUNCTION - << "\ny1: " << y1 - << " y2: " << y2 - << " pit: " << bottom_pit - << " singlepar: " << singlepar - << endl; - return; + tm.redoParagraph(bottom_pit); + ParagraphMetrics const & pm = tm.parMetrics(bottom_pit); + if (pm.height() == old_height) { + // Paragraph height has not changed so we can proceed to + // the singlePar optimisation. + updateOffsetRef(); + int y1 = pm.position() - pm.ascent(); + int y2 = pm.position() + pm.descent(); + metrics_info_ = ViewMetricsInfo(bottom_pit, bottom_pit, y1, y2, + SingleParUpdate, npit); + LYXERR(Debug::PAINTING) + << BOOST_CURRENT_FUNCTION + << "\ny1: " << y1 + << " y2: " << y2 + << " pit: " << bottom_pit + << " singlepar: " << singlepar + << endl; + return; + } } pit_type const pit = anchor_ref_;